How To Pass Parameter With Quotation Marks
I can do this in my query: SELECT * FROM OPENROWSET(BULK 'C:\myPC.file', SINGLE_BLOB) but how do I do this? Declare @Var = 'C:\myPC.file' SELECT * FROM OPENROWSET(BULK @Var,
Solution 1:
You can not parametrise OPENROWSET (or OPERNQUERY etc). Constants only.
Declare @Var = 'C:\myPC.file';
Declare @SQL varchar(1000);
SET @SQL = 'SELECT * FROM OPENROWSET(BULK ''' + @Var + ''', SINGLE_BLOB)';
EXEC (@sql)
Post a Comment for "How To Pass Parameter With Quotation Marks"