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 2008 Forums
 SSIS and Import/Export (2008)
 Script Blank to Null

Author  Topic 

Brittney10
Posting Yak Master

154 Posts

Posted - 2013-11-26 : 16:56:03
I have 100+ fields that I'm working with in a flat file and if the value coming in is Blank or Empty I was to change that to NULL before I insert into an OLE DB Destination. Is there a quick and easy way to do this in script task or does it have to do be done in a Derived task? I was hoping for a script task, so I didn't have to make 100+ derived columns with the logic. Any help or direction is appreciated.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-11-27 : 04:59:10
easiest and fastest way is to dump it to table first and then apply a t-sql update statement like below

 
UPDATE Table
SET Col1 = NULLIF(Col1,''),
Col2=NULLIF(Col2,''),
....

this will do modification in set based manner in one shot rather than in SSIS data flow where processing happens row by row.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -