SET @fullPath = 'D:\Hosting\Project\Content\Order\ImportTest.txt'
SET @command = N'select @data_count =(select len(BulkColumn) - len(replace(BulkColumn,
char(10), '')) 1
from OPENROWSET(BULK ''' @fullPath ''',
SINGLE_CLOB) ROW_SET'
EXEC(@command)
The commands above are generating the following error:
Msg 102, Level 15, State 1, Line 2
Incorrect syntax near 'D:'.Msg 105, Level 15, State 1, Line 2
Unclosed quotation mark after the character string ', SINGLE_CLOB) ROW_SET'.
How do I fix the above issue?
CodePudding user response:
Just as you escaped the single quotes in BULK ''' @fullPath '''
you have to do it here: char(10), ''''
.