Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 Script Blank to Null
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Brittney10
Posting Yak Master

USA
154 Posts

Posted - 11/26/2013 :  16:56:03  Show Profile  Reply with Quote
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

India
52326 Posts

Posted - 11/27/2013 :  04:59:10  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000