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

 All Forums
 SQL Server 2012 Forums
 SSIS and Import/Export (2012)
 Derived Column Expression Help
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

tooba
Posting Yak Master

165 Posts

Posted - 08/25/2014 :  12:21:53  Show Profile  Reply with Quote
Here is my Sample Data

ID,SID,FNAME
1,17,SMITH
2,6,JON
3,17,NOR

Here is my destination Columns and condition

ID,SID,SID2,FNAME

I want condion in derived column

IF SID = '17' then insert the value in SID
IF SID = '6' then insert the value in SID2

Here is the my final output looks like.

ID,SID,SID2,FNAME
1,17,,SMITH
2,,6,JON
3,17,,NOR

Any help?

Thank You

gbritton
Aged Yak Warrior

803 Posts

Posted - 08/25/2014 :  12:48:21  Show Profile  Reply with Quote
I did it with two DC column expressions:


Derived Column Name   Derived Column       Expression                     Data Type
SID                   Replace 'SID'        SID == 17 ? 17 : NULL(DT_I4)   DT_I4 
SID2                  <add as new column>  SID == 6 ? SID : NULL(DT_I4)   DT_I4

Go to Top of Page

tooba
Posting Yak Master

165 Posts

Posted - 08/25/2014 :  16:43:25  Show Profile  Reply with Quote
Awesome..... Thank You so much.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New 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.05 seconds. Powered By: Snitz Forums 2000