Hello,

I'm using SQLBulkCopy to import data from a text file. There is a lot of data involved and I would really rather not import it row by row. There seems to be a problem with fields containing both numbers and text. (for example, a phone number '555-1212'). All fields that are mixed (numeric / text) are imported as null. Is there anyway to get this working?

I have no control over the format of the text file, as it is an export of data from a vendor application.

Thanks,
Rachel

Recommended Answers

All 2 Replies

Hi Rachel, you may get better answers from the MS SQL forum - http://www.daniweb.com/forums/forum127.html

But here's a hunch anyway: Might there be a problem mapping fields from source to destination? Are you sure the destination phone field is expecting text?

myBulkCopy.ColumnMappings.Add(blaah blaah)

Thanks, but yes, I'm sure the mappings are correct. I even changed the columns to text from varchar, expecting them to work. There aren't that many rows of data, but there are 153 columns (terrible, I know, but not my doing), and changing methods now would be time consuming for that reason.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.