bulk insert - crazy int values

Joined
Jan 10, 2007
Messages
43,898
Location
In The Machine
Hi,

Im having some issues with BULK INSERT.
The table only has two columns, one INT and one VARCHAR column.

The table:
CREATETABLE [dbo].[GA_status](
[GA_recno] [int] NOTNULL,
[GA_desc] [varchar](40)NULL)

The data file (UTF-8):
1|10848|
2|10849|
3|12611|
4|10102|
5|10137|
6|12693|
7|10149|
8|12712|

The format file:
8.0
2
1**SQLINT**0**4***"|"**1**GA_recno*""
2**SQLCHAR**0**40***"|"**2**GA_desc*SQL_Latin1_General_CP1_CI_AS


The SQL:
BULKINSERT tmp_GA_status FROM'C:\temp\TextDump\MSSQL\GA_status.dta'WITH(FORMATFILE='C:\temp\TextDump\MSSQL\GA_status.fmt',DATAFILETYPE='char',ROWTERMINATOR='\n\r')


Okei so far so good. The sql runs and insert 8 rows, but the int values are different from the data file.
This is the result after insert:

GA_recno******GA_desc
834649071***10848
3279373******10849
3344909******12611
3410445******10102
3475981******10137
3541517******12693
3607053******10149
3672589******12712


Any ideas on how to fix it ??



More...

View All Our Microsoft Related Feeds
 
Back
Top