I've tried to import a text file into a table using the Import/export wizard.
My problem starts with some columns that should have NULL values (i.e. zero-length string) but the wizard doesn't recognize that it's NULL.
How do I solve the problem?
Thanks,
Mich
First, a zero-length is not NULL. NULL is a special character.
If you want NULLs to be inserted, open up the package and edit it (that the import/export wizard created for you) and add a derived column transformation before going to the destination.
Use an expression similar to this for each of your columns:
[myColumn] == "" ? NULL(DT_WSTR,20) : [myColumn]
I'm going by memory, but I believe that would work. The above assumes myColumn has a length of 20 bytes.
|||Thank you for your answer.
My knowledge of the import/export wizard is limited.
I would like to know whether the expression should be added in the "Suggest Types" button or elsewhere.
Is the expression related to the destination column names or the columns the Wizard created?
I'd appreciate it if you could give me a step-by-step guide on how to do it, since I found the sql help file very unhelpful.
Thank you again.