Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Bulk Insert Errors

Author  Topic 

Nitu
Yak Posting Veteran

81 Posts

Posted - 2006-06-15 : 14:09:05
Hi,

I am getting errors when i am trying to execute a bulk insert statement. I have a csv file, i want to move the data from csv to a sql table. The csv i have has 63 columns, but the sql table has 74 columns. The idea behind having 74 columns in sql table is i am using this as one big master holding table where different csv files with different schemas can be stored here before processing data and then distributing data into appropriate original tables.

Is it possible to insert these 63 columns of rows into a sql table with 74 columns.

When i do this the errors i get are


Server: Msg 4863, Level 16, State 1, Line 1
Bulk insert data conversion error (truncation) for row 1, column 74 (fld74).
Server: Msg 4863, Level 16, State 1, Line 1
Bulk insert data conversion error (truncation) for row 2, column 74 (fld74).
Server: Msg 4863, Level 16, State 1, Line 1
Bulk insert data conversion error (truncation) for row 3, column 74 (fld74).
Server: Msg 4863, Level 16, State 1, Line 1
Bulk insert data conversion error (truncation) for row 4, column 74 (fld74).
Server: Msg 4863, Level 16, State 1, Line 1
Bulk insert data conversion error (truncation) for row 5, column 74 (fld74).
Server: Msg 4863, Level 16, State 1, Line 1
Bulk insert data conversion error (truncation) for row 6, column 74 (fld74).
Server: Msg 4863, Level 16, State 1, Line 1
Bulk insert data conversion error (truncation) for row 7, column 74 (fld74).


Is this because the num of columns dont match. Please help me on this one.

I actually tried to Use bulk insert on csv & sql table which have same num of columns and it works. Please let me know if there is a way around to insert data from a csv in to sql table where the columns in csv are less than those in sql table, beacause that is what i want to do.

Thanks a lot in advance,
Nitu

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-06-15 : 14:14:40
i am not sure with bulk insert. you could give "allow null" a chance for the last 12 columns.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

Nitu
Yak Posting Veteran

81 Posts

Posted - 2006-06-15 : 14:59:59
I allow nulls for all the 74 fields.

Is there anything i am missing here. Please let me know.

THanks a lot in advance
Nitu
Go to Top of Page
   

- Advertisement -