September 18, 2009 at 9:10 am
Using the SSIS package 'Expression Builder' how can I convert my variable @pActiveDate value: 20070918 to 091807
This sample T-SQL will do it:
DECLARE @yyyymmdd CHAR(8)
SET @yyyymmdd = '20070918'
SELECT replace(convert(varchar,convert(datetime,@yyyymmdd,10), 10),'-','')
But I can't seen to retrofit this into the 'Expression Builder' for this variable.. Need to get the "... replace(convert(varchar.... " to pass the syntax check in 'Expression Builder'.
September 18, 2009 at 9:36 am
The Expression Builder doesn't use sql.
If the data type of your variable is numeric, this will work:
SUBSTRING((DT_STR, 8, 1252)@[User::pActiveDate], 5, 2) + SUBSTRING((DT_STR, 8, 1252)@[User::pActiveDate], 7, 2) + SUBSTRING((DT_STR, 8, 1252)@[User::pActiveDate], 3, 2)
If it's a string, this will work:
SUBSTRING( @[User::pActiveDate] , 5, 2) + SUBSTRING( @[User::pActiveDate] , 7, 2) + SUBSTRING( @[User::pActiveDate] , 3, 2)
September 18, 2009 at 10:20 am
your solution worked like a charm.. thanks Erik..
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply