我正在尝试在SQL表中进行批量插入,并且在运行存储过程时,我不断收到错误Bulk加载数据转换错误(截断)。我已经包含了一个行和字段终止符。任何想法在这里可能是错的? TY
源文件在每个字段之间都有标签。
ALTER PROCEDURE [dbo].[sp_app_Import]
AS
DECLARE @SQL varchar(2000)
/*Truncate temporary table*/
TRUNCATE TABLE tbltableTemp
BULK INSERT tbltableTemp
FROM '\\server\public\Source_Files\test.txt'
WITH (FIELDTERMINATOR='\t', ROWTERMINATOR = '\r', FIRSTROW = 2)
/*Truncate permanent table*/
TRUNCATE TABLE tbl_test
INSERT INTO tbl_test
(MemberID,FacilityName,FacilityAddress1,FacilityAddress2,FacilityCity,FacilityState,FacilityZip,HIN,GLN,LIC,GPO)
SELECT '' AS MembershipID,RawData6 as FacilityName, RawData7 as FacilityAddress1,RawData8 as FacilityAddress2,RawData9 as FacilityCity, RawData10 as FacilityState,
RawData11 as FacilityZip, RawData26 as HIN, RawData2 as GLN, RawData1 as LIC, 'test' as GPO
FROM tbltableTemp