Sunday, February 19, 2012

Inserting Nulls with DTS

I am using a DTS package to copy data from a flat file to a table. I need for fields that are empty to be changed to nulls in the output. I wrote a VB Script to do this, but now it takes about 10 times longer that when I used the Copy transformation. Is there a faster way to do this?

I haven't tried the Trim transformation yet. (I'm waiting for my load to finish.) Will that place nulls in the output if a field is empty?Originally posted by jsneeringer
I am using a DTS package to copy data from a flat file to a table. I need for fields that are empty to be changed to nulls in the output. I wrote a VB Script to do this, but now it takes about 10 times longer that when I used the Copy transformation. Is there a faster way to do this?

I haven't tried the Trim transformation yet. (I'm waiting for my load to finish.) Will that place nulls in the output if a field is empty?

Hi,
1-in your SQL Server Table ( Destination DB) set a default value for the field(s), so when you attemp to insert Null value in that Field, the specified default vale will be insert. ( the way of inserting is not important . It can be DTS!!)

2- you can also write a Instead Of Trigger on your Table For Insert, so process the field value, if it's Null , write empty.

Hope that help you

No comments:

Post a Comment