Saturday, February 25, 2012

Bulk Insert

I have a problem with bulk insert importation. I have a txt file with 3400 columns and 1 table with two fields.

data - varchar(5000)
id - numeric (identity yes - 1)

when I import the file the system return this error message:

Bulk Insert fails. Column is too long in the data file for row 1, column 1. Make sure the field terminator and row terminator are specified correctly.

my bulk insert sintaxe is:

BULK INSERT eflex.dbo.Import_Data
FROM 'C:\HP\HP_Receive\FBSJ01D5.txt'
WITH (FIELDTERMINATOR = '\n')

can anybody help-me?

thanks,Sure
1. What is your row terminator?
2. Maybe the data row exceeds your definition.
3-n any number of data or schema errors

Try this ... create a input table with 1 column defined as varchar(8000), then bcp in the file. You can then use SQL Server to inspect column lengths, and even parse the data into your working table.

No comments:

Post a Comment