任何人都可以帮我纠正以下声明:
SET @cmd='BULK INSERT ' + @Database + '.dbo.' + @tmp + ' from ' + @Out + @tmp + '.csv
WITH (FIELDTERMINATOR = , , ROWTERMINATOR = \n)'
以上查询的输出为:
BULK INSERT MP2.dbo.GLCODE来自C:\ SABA \ GLCODE.csv WITH (FIELDTERMINATOR = ,, ROWTERMINATOR = \ n)
我想以下面的方式打印:
BULK INSERT MP2.dbo.GLCODE来自C:\ SABA \ GLCODE.csv WITH (FIELDTERMINATOR =',',ROWTERMINATOR ='\ n')
答案 0 :(得分:0)
试试这个
SET @cmd='BULK INSERT ' + @Database + '.dbo.' + @tmp + ' from ' + @Out + @tmp +
'.csv WITH (FIELDTERMINATOR = '','' , ROWTERMINATOR = ''\n'')'
只需使用''
作为转义序列字符即可获得额外的'
答案 1 :(得分:0)
SET @cmd='BULK INSERT ' + @Database + '.dbo.' + @tmp + ' from ''' + @Out + @tmp + '.csv'' WITH (FIELDTERMINATOR = '','', ROWTERMINATOR = ''\n'')'
Yogi建议的方法应该有效,但你还需要在文件名周围放置撇号。