Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 SSIS Import Text file to SQL Server with nulls?

Author  Topic 

MuadDBA

628 Posts

Posted - 2007-01-23 : 11:43:23
I have a text file I am trying to import into SQL Server using OLEDB connection.

It's a fixed field text file, ragged right format. One of my columns maps to a numeric column in the DB. In some spots in the file, it is blank, in others there is actual numeric data.

I can't get it to import. If I set the text file column to numeric, I get an error "That value could not be converted because of a potential loss of data." If I set the text file column to string, I get a similar error from the OLE DB provider, "Invalid character value for cast specification"

I have tried telling it to retain nulls in the data flow and the other way as well. Can someone tell me what I am doing wrong?

tacket
Starting Member

47 Posts

Posted - 2007-01-23 : 17:24:22
I'll stab at this one.. Try setting the text file, wherever the value is spaces or null or whatever, to zero or some other number that you know represents blanks. Then you can update the table after. Some other folks might give better input on exactly why it doesn't like spaces, although I'm not sure why string don't work.
Go to Top of Page
   

- Advertisement -