hi how to use SSIS transforms for case condition
Hi all,
I am new to SSIS i need to use ssis transforms
i have source table t1 in that i have to map it destination table t2 all columns in source table t1 is directly mapped to destination t2 but their is one column called Sbtype which is to be transformed or converted which is having the value
M and N this value as to alterd and mapped to destination
for M it should be as Member and for
N it should be as non member. how i can achieve this using SSIS Transform and expression
i am not allowed to use Execute SQL task. please help thanks in Advance
Regards
Sunil Yoganna
January 12th, 2011 7:31am
you can use a drived column transform
it has ability to write expresion,
in your case it will be like -
Sbtype =="M" ?"MEMBER" : (Sbtype =="N"
? "NONMEMBER" : "Unknow")
Gaurav Gupta http://sqlservermsbiblog.blogspot.com/
Free Windows Admin Tool Kit Click here and download it now
January 12th, 2011 7:50am
Hi Guptha,
Thanks for ur Replay ur logic works fine by assigning default values if i want fetch from The member & Non member values which is presented in another table T3 in another database D3 where it is having 2 columns NewSbtype &
OldSbtype
and it is having values like below
Newbtype OldSbtype
Member M
NonMember N
Chairman C
President P
Senior Citizen S
-- --
-- --
the values in Sbtype in t1 and oldsbtype in table t3 of Database D3 are same.
How i can in corporate this in SSIS for fetching values from other table what about the connection how i can achieve this. Please help thanks in Advance.
Regards
Sunil Yoganna
January 12th, 2011 8:18am
Hi Guptha,
Thanks for ur Replay The member & Non member value is presented in another table T3 in another database D3 where it is having 2 columns NewSbtype & OldSbtype
Where it is having values like below
Newbtype OldSbtype
Member M
NonMember N
Chairman C
President P
Senior Citizen S
-- --
-- --
the values in Sbtype in t1 and oldsbtype in table t3 of Database D3 are same
The following T-SQL query is used to achieve this
select t3. Newbtype from db3.dbo.t3 as t3 join
db1.dbo.t1 as t1
on t3.OldSbtype =t1.sbtype
how i can in corporate this in SSIS for fetching values from other table what about the connection how i can achieve this. Please help thanks in Advance.
Regards
Sunil Yoganna
Free Windows Admin Tool Kit Click here and download it now
January 12th, 2011 8:22am
Hi,
If you want obtain values from a reference table, the best option is implement a Lookup component. In your scenario the reference table is the table t3 on D3 database, and use the SbType linked to OldSbtype to get the NewType on each row.
Regards.Vctor M. Snchez Garca (ES) (BI) Hope this help. Please vote if you find this posting was helpful. if this is an answer to your question, please mark it. http://bifase.blogspot.com | http://twitter.com/atharky
January 12th, 2011 9:02am