November 18, 2008 at 12:08 pm
I'd like to replace all empty values in a table to
NULL's.
First I used Derived Column Transformation Expression:
COL008 == "" ? (DT_STR,255,1252)NULL(DT_STR,255,1252) : COL008
But I was wondering if there is a way to
replace all values in one shot and without specifying column names.
Script component maybe?
November 18, 2008 at 12:24 pm
What is your source? Most products have a conversion like SQL Server's NULLIF or you can use CASE of IIF depending on the source to do at as part of your source query.
Another option I have used is to load the empty values into SQL Server then add an Execute SQL Task as the next step in the Flow that does an Update statement. Update table Set column = Null where column = ''
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
November 18, 2008 at 12:39 pm
Hi Jack,
Of course SQL code will solve this very easily.
But remember? My boss doesn't want to see any "Execute SQL" Tasks
in SSIS. Unfortunately....
Unless it's really has a value and is reusable.
November 18, 2008 at 12:49 pm
Odds are with all my posts I'm not going to remember all the requirements based on the OP. Now that you mention it I do recall, but I still think it is a foolish requirement and impediment to success. You'd be done by now if allowed to use a few well placed Execute SQL Tasks.
It does have value. The value is that it will perform probably 100 times faster than looping through all your rows and changing the values 1 by 1 in SSIS. IT is also easier to read and figure out.
Like I also said you can probably do it in your source query. What is your source? I've done it with FoxPro and if you can do it with that you can do it with anything, except maybe a flat file.:D
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
November 18, 2008 at 8:30 pm
Jack Corbett (11/18/2008)
Now that you mention it I do recall, but I still think it is a foolish requirement and impediment to success. You'd be done by now if allowed to use a few well placed Execute SQL Tasks.
The boss would be wiser to forbid the use of SSIS than to forbid "Excute SQL" tasks in SSIS.
riga1966 (11/18/2008)
Hi Jack,Of course SQL code will solve this very easily.
But remember? My boss doesn't want to see any "Execute SQL" Tasks
in SSIS. Unfortunately....
Unless it's really has a value and is reusable.
Write the WHILE loop for your boss... have him/her test it on a million rows. Then give him/her the equivalent simple set-based UPDATE and have him/her test it again. The boss [font="Arial Black"]will [/font]see the "real value".
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply