August 9, 2016 at 2:04 pm
Hello I m trying to achieve something like this without patindex
DECLARE @source_path nvarchar(1000)
SET @source_path = 'hello_there_123.zip'
PRINT @source_path
--Expected Result is using getdate() add date before .zip
SELECT @source_path = hello_there_123_08092016.zip
Please help. Thanks.
August 9, 2016 at 2:15 pm
dallas13 (8/9/2016)
Hello I m trying to achieve something like this without patindex
DECLARE @source_path nvarchar(1000)
SET @source_path = 'hello_there_123.zip'
PRINT @source_path
--Expected Result is using getdate() add date before .zip
SELECT @source_path = hello_there_123_08092016.zip
Please help. Thanks.
Like this:
DECLARE @source_path nvarchar(1000),
@Date char(9);
set @Date = '_' + convert(char(8),getdate(),112);
SET @source_path = stuff('hello_there_123.zip',patindex('%.zip','hello_there_123.zip'),0,@Date);
PRINT @source_path
August 9, 2016 at 2:30 pm
dallas13 (8/9/2016)
Hello I m trying to achieve something like this without patindex
DECLARE @source_path nvarchar(1000)
SET @source_path = 'hello_there_123.zip'
PRINT @source_path
--Expected Result is using getdate() add date before .zip
SELECT @source_path = hello_there_123_08092016.zip
Please help. Thanks.
Why the aversion to using patindex? When doing string manipulations it's a pretty basic & important function.
August 9, 2016 at 2:32 pm
Y.B. (8/9/2016)
dallas13 (8/9/2016)
Hello I m trying to achieve something like this without patindex
DECLARE @source_path nvarchar(1000)
SET @source_path = 'hello_there_123.zip'
PRINT @source_path
--Expected Result is using getdate() add date before .zip
SELECT @source_path = hello_there_123_08092016.zip
Please help. Thanks.
Why the aversion to using patindex? When doing string manipulations it's a pretty basic & important function.
Wow, I missed that part about not using PATINDEX.
August 9, 2016 at 3:15 pm
Thanks guys.
Patindex is not supoorted in ssis i guess. So if i use this in ssis then it may be prob. but i think i understand the logic here and thanks again.
August 9, 2016 at 3:54 pm
dallas13 (8/9/2016)
Thanks guys.Patindex is not supoorted in ssis i guess. So if i use this in ssis then it may be prob. but i think i understand the logic here and thanks again.
Well, you didn't say anything about this needing to be done in SSIS. It appeared you had a SQL question and you got a SQL answer.
August 9, 2016 at 3:56 pm
You can use FindString in SSIS since you are looking for '.zip' in the string.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply