xml
6 TopicsUsing variables in select and xml files
Hi I have created a t-sql that read an xml file and store it into ms sql 2016 database. DECLARE @x xml, @@XML_Location VARCHAR(255) = 'FROM OPENROWSET (BULK ''''\\xmlsrv\proxml\' @XML_File VARCHAR(255) = 'GEN.xml', ; SELECT @x = P --FROM OPENROWSET (BULK '\\xmlsrv\proxml\GEN.xml', SINGLE_BLOB) AS Element(P) @XML_Location & @XML_File, SINGLE_BLOB) AS Element(P) ....... .... The script works if i use the from statement directly, but if I try to use declared variables it fails with message: Msg 102, Level 15, State 1, Line 16 Incorrect syntax near '@XML_Location '. What am I doing wrong? BR Dan-Ketil1.5KViews0likes0CommentsParsing larger XML file using “sp_OACreate” returns incorrect values
First published on MSDN on Oct 23, 2009 sp_OACreate is a way to instantiate OLE / COM objects inside of SQL Server in the MemToLeave area of the server’s address space, or out of process in dllhost.2.3KViews0likes0Comments