Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSV to SQL table with not allow null issue

Status
Not open for further replies.

Cpreston

MIS
Mar 4, 2015
972
GB
I have a CSV file import which as a couple of issues due to the Source file not having some data

One of the columns will always be Empty but the database destination does not allow Nulls
A column in the Destination is not present in the CSV file and also does not allow null values

So obviously the SSIS package fails. I can I get package to work so it thinks the data is there.

The source file comes from a machine and cannot be change to match the exact destination table
 
I have managed to use a Derived filed with the Expression using this ISNULL(TreatNo) ? " " : TreatNo
This allows me to update without any data

However, I have a field available in the source file called CyNo which as the data I could do with in TreatNo. Can you use a derived field to use the data in TreatNo for CyNo and if so what should the Expression be like.

Thanks
 
Instead of going through such indirections of field expressions, create a temp table for import and get that imported data into the target table from there. That's always the solution for not having completely propriate CSV.
 
Thanks Chris, not sure how I would do that a bit beyond what little skills I have. Thanks for the reply.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top