How to achieve the below condition in ssis
if person_id is like '123%' or '124%'
then details='xyz'
else details
Technology Tips and News
How to achieve the below condition in ssis
if person_id is like '123%' or '124%'
then details='xyz'
else details
FINDSTRING( [Col A], "123",1 ) >0?"xyz":(FINDSTRING( [Col A], "124",1 ) >0)?"yxz":"whatever you wnat"
Basically, it is saying find "123" if it finds replace it with "xyz" else find "124" if found replace it with "yxz", if not found replace it with "what ever you want" in your case. Hope it helps!
https://msdn.microsoft.com/en-us/library/ms141680.aspx
You can use the new TOKENCOUNT function
something like
TOKENCOUNT("123",colname) > 1 ? <do for true> : <do for false>
essentially tokencount would return more than 1 if it finds the string
FINDSTRING( [Col A], "123",1 ) >0?"xyz":(FINDSTRING( [Col A], "124",1 ) >0)?"yxz":"whatever you wnat"
Basically, it is saying find "123" if it finds replace it with "xyz" else find "124" if found replace it with "yxz", if not found replace it with "what ever you want" in your case. Hope it helps!
https://msdn.microsoft.com/en-us/library/ms141680.aspx
FINDSTRING( [Col A], "123",1 ) >0?"xyz":(FINDSTRING( [Col A], "124",1 ) >0)?"yxz":"whatever you wnat"
Basically, it is saying find "123" if it finds replace it with "xyz" else find "124" if found replace it with "yxz", if not found replace it with "what ever you want" in your case. Hope it helps!
https://msdn.microsoft.com/en-us/library/ms141680.aspx
Since you want to find the first three characters, you can simply use the LEFT function provided you are on 2012/2014 version as the earlier versions are missing the LEFT function.
Check the link MSDN
Else you can use Findstring or Substring function.
SUBSTRING(person_id,1,3) == "123" || SUBSTRING(person_id,1,3) == "124" ? "xyz" : "yxz"
Hope this will help
Regards
Since you want to find the first three characters, you can simply use the LEFT function provided you are on 2012/2014 version as the earlier versions are missing the LEFT function.
Check the link MSDN
Else you can use Findstring or Substring function.
SUBSTRING(person_id,1,3) == "123" || SUBSTRING(person_id,1,3) == "124" ? "xyz" : "yxz"
Hope this will help
Regards