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 2005 Forums
 Transact-SQL (2005)
 Bulk Insert Error

Author  Topic 

bconner
Starting Member

48 Posts

Posted - 2010-01-21 : 22:11:16
I am trying to run the below script on a test file...


Source File:

"SJCQ"|"8"|"12285045"
"SJCQ"|"8"|"12285045"
"SJCQ"|"8"|"12285045"
"SJCQ"|"8"|"12285045"

I created the Format File:

9.0
3
1 SQLCHAR 0 0 "\"" 0 "" ""
2 SQLCHAR 0 80 "\"|\"" 1 Division Latin1_General_CS_AS
3 SQLCHAR 0 80 "\"|\"" 2 Group_ID Latin1_General_CS_AS
4 SQLCHAR 0 80 "\"\n" 3 Invoice_Number Latin1_General_CS_AS

My SQL Code is:

BULK INSERT DeepDiveGroup8.dbo.atb_tbl
FROM 'C:\Test\GRP 8 NEW ATB DETAIL DEC 2009.txt'
WITH
(
FIELDTERMINATOR = '|',
ROWTERMINATOR = '\n',
formatfile = 'c:\Test\Test_Format_File.txt',
KEEPNULLS
)

When I Execute I get the below error:

Msg 4864, Level 16, State 1, Line 1
Bulk load data conversion error (type mismatch or invalid character for the
specified codepage) for row 3, column 3 (GROUP_ID).

I can't figure out what is wrong with Column 3 I have it as INT datatype in the Table..

Can anyone help? thanks..


Brian
   

- Advertisement -