467,915 Members | 1,227 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,915 developers. It's quick & easy.

BULK INSERT not inserting string with 'D'

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?
Jan 22 '09 #1
  • viewed: 1658
5 Replies
Expert 2GB
Do you use FMT file?

-- CK
Jan 22 '09 #2
No. Can I specify the field type in the format file?
Jan 22 '09 #3
Expert 2GB
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
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
Expert 2GB
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.

Similar topics

16 posts views Thread by Philip Boonzaaier | last post: by
2 posts views Thread by bob.speaking | last post: by
reply views Thread by bob laughland | last post: by
3 posts views Thread by bob laughland | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.