Etienne
Etienne

Reputation: 7201

Convert String to Integer with SSIS from .CSV

I am using a .CSV file and I am using SSIS 2008.

Source: .CSV

Destination: Database

SSIS see all the columns in my .CSV as a string.

But I need to push 1 column into a database column of type INT.

Nothing want to work though, I have placed a DataConversion in my SSIS package between the source and the destination and none of the Data Type's of integer wants to work.

Error message:

The conversion returned status value 2 and status text "The value could not be converted because of a potential loss of data."

Any input on whats going on here? It does not even want to work using the Wizard.

Edit: Sample data as requested------------------------------------------------------------------------

Name|ID

Mike|1266

John|NULL

Upvotes: 1

Views: 4335

Answers (1)

SQLGuru
SQLGuru

Reputation: 1099

ok... your issue is the fact that you have the physical value "NULL" in your CSV. these should be left blank. By having "NULL" there, it is trying to convert the string "NULL" to an int which it cannot do.

Just make sure all "NULL" values are blank (zero length string). that should sort you out.

Upvotes: 4

Related Questions