March 7, 2008 at 10:49 am
I am trying to do this
Declare @filename varchar(125)
set @filename = 'C:\testdata.xml'
select Bulkcolumn FROM OPENROWSET (BULK '"' +@filename +'"', SINGLE_CLOB) AS xmlDatatest
I get this error: Incorrect syntax near '+'.
When I do the same thing using a select statement
SELECT '"'+ @filename +'"' AS testdata it works fine
result is 'C:\testdata.xml'
Any other way to do this.
Thanks
Bunmi
March 7, 2008 at 1:15 pm
The reason why you have to do it with Dynamic SQL is because it will not allow you to do formulas in the query. The Query must be "hard -code" (for lack of a better term). The dynamic SQL makes it appear as such.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply