Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bulk load data conversion error (truncation) for row 7 1

Status
Not open for further replies.

whateveragain

Programmer
Apr 20, 2009
92
US
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
 
Just guessing.... you want to use a RowTerminator, not a field terminator.

-George
Microsoft SQL Server MVP
My Blogs
SQLCop
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
It turned out that I had 7 ZIPs and had qualifiers on the last ZIP. I wasn't careful in cleaning the data.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top