whateveragain
Programmer
The following dynamic bulk insert works but gives an error on the last record. I checked the import and the data was in the file. What would cause this error?
ERROR MSG:
Bulk load data conversion error (truncation) for row 7, column 1 (dircode).
[Note: Dircode is the name of the column of the table the data is being imported into. I am only importing 6 records with 1 columns. There is only one column in the table that I'm importing into. The FIELDTERMINATOR is not necessary, but it wouldn't work without it.}
CODE:
create table #mydirectories
(dircode char(5))
I tried both bulk statements. Both work with the same error above:
SET @SQL = 'BULK INSERT #mydirectories FROM "' + @Impfilename + '" WITH (FIELDTERMINATOR = '','')'
SET @SQL = 'BULK INSERT #mydirectories FROM "' + @Impfilename + '"'
FILE DATA:
12345
12224
12206
12206
12154
12047
ERROR MSG:
Bulk load data conversion error (truncation) for row 7, column 1 (dircode).
[Note: Dircode is the name of the column of the table the data is being imported into. I am only importing 6 records with 1 columns. There is only one column in the table that I'm importing into. The FIELDTERMINATOR is not necessary, but it wouldn't work without it.}
CODE:
create table #mydirectories
(dircode char(5))
I tried both bulk statements. Both work with the same error above:
SET @SQL = 'BULK INSERT #mydirectories FROM "' + @Impfilename + '" WITH (FIELDTERMINATOR = '','')'
SET @SQL = 'BULK INSERT #mydirectories FROM "' + @Impfilename + '"'
FILE DATA:
12345
12224
12206
12206
12154
12047