May 3, 2010 at 5:58 am
Hi,
I created a variable with name 'source_file' with string data type and default value is 'C:\test'. In my expression i want only 'test'.How to extract only "test" into my expression.
May 3, 2010 at 6:30 am
Hi
My solution is based on the assumption that you have only a single "\" in your string. i.e. the variable will not contain a value like 'C\test\test". Note the two "\" values (slash) in the string.
declare @e varchar(10)
set @e = 'C:\test'
select substring(@e,charindex('\',@e)+1,len(@e))
Edit: - I hope you are not looking for SSIS expressions.
"Keep Trying"
May 3, 2010 at 7:18 am
elchuru (5/3/2010)
Hi,I created a variable with name 'source_file' with string data type and default value is 'C:\test'. In my expression i want only 'test'.How to extract only "test" into my expression.
Check this expression:
Replace the Variable - VariableName with your variable name in the expression
SUBSTRING(VariableName,FINDSTRING(VariableName,"\\",1)+1,(LEN(VariableName) - FINDSTRING(VariableName,"\\",1)))
May 3, 2010 at 7:22 am
ChiragNS (5/3/2010)
HiMy solution is based on the assumption that you have only a single "\" in your string. i.e. the variable will not contain a value like 'C\test\test". Note the two "\" values (slash) in the string.
declare @e varchar(10)
set @e = 'C:\test'
select substring(@e,charindex('\',@e)+1,len(@e))
Edit: - I hope you are not looking for SSIS expressions.
Its SSIS expression
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply