Jump to content

Recommended Posts

Posted

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

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...