By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,415 Members | 1,568 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,415 IT Pros & Developers. It's quick & easy.

BULK INSERT not inserting string with 'D'

P: 3
I am using BULK INSERT to load one of my files into the database. I noticed that values like 5D08, 08D038 is getting converted to numeric values like 500000000 and 8E+38 resp even though the field in the database is varchar. Has anybody seen this before? How can I prevent this?
Thanks.
Jan 22 '09 #1
Share this Question
Share on Google+
5 Replies


ck9663
Expert 2.5K+
P: 2,878
Do you use FMT file?

-- CK
Jan 22 '09 #2

P: 3
No. Can I specify the field type in the format file?
Jan 22 '09 #3

ck9663
Expert 2.5K+
P: 2,878
Yes. But that did not really answer your question :)

Is it possible to post here the structure of your target table and your BULK INSERT statement?

-- CK
Jan 22 '09 #4

P: 3
My bad - its actually sqlbulkcopy class that I am using, though functionally it is the same as bulk insert.
Here is my connection string
Provider=Microsoft.Jet.OLEDB.4.0;Data Source='C:\temp\temp.csv';Extended Properties='text;HDR=No;FMT=Delimited'

lets say this is my target table, Column C and Column H are the ones thats causing the issue.

[A] varchar(30),
[b] varchar(90),
[C] varchar(25),
[D] datetime,
[E] varchar(10),
[F] varchar(25),
[G] varchar(10),
[H] varchar(25),
[i] float,
[J] varchar(25),
[K] varchar(25),
[L] varchar(10),
[M] datetime,
[M] datetime,

I am considering using schema.ini now but would like to know if there is another option. Thanks.
Jan 22 '09 #5

ck9663
Expert 2.5K+
P: 2,878
Check your file. There could be a delimiter within one of the data on the left. Also, can't you use BULK INSERT? CSV are just ordinary text, you can use BULK INSERT to import the file.


-- CK
Jan 23 '09 #6

Post your reply

Sign in to post your reply or Sign up for a free account.