我正在尝试将来自多个文件的数据插入 SQL Server。这是我正在使用的代码——
DECLARE @MyCounter int;
DECLARE @Fileprefix nvarchar, @Filesuffix nvarchar, @fullname nvarchar, @Counter_string nvarchar;
SET @MyCounter = 1;
SET @Fileprefix= 'C:\Arvind_gpd\patents\';
SET @Filesuffix='data_corrected.csv';
WHILE (@MyCounter < 10)
BEGIN;
Set @Counter_string= Cast(@MyCounter AS varchar(1) );
Set @fullname = (@Fileprefix+ @Counter_string + @Filesuffix );
BULK INSERT GooglePatentsIndividualDec2012.dbo.patent
FROM @fullname WITH ( DATAFILETYPE = 'char', FIELDTERMINATOR = '^', ROWTERMINATOR = '\n' );
SET @MyCounter = @MyCounter + 1;
END;
GO
但是我收到这些错误消息-
Incorrect syntax near @fullname. Expecting Integer, String, TEXT_LEX.....
Incorrect syntax near DATAFILETYPE. Expecting SELECT or '('
我在上面的查询中做错了什么?