Date to String Conversion in SSIS Variable
Hi All - I have an SSIS variable whose value is a date formatted as a string in YYYYMM. For example 201011 (meaning Nov 2010). I need to change the value to 201012 (meaning Dec 2010). My thought was to convert 201011 to a date, use dateadd, then convert back to a string. Something like: (DT_STR)DATEADD(mm, 1, (DT_DBDATE) @[User::strVar] + '01'), 6, 1552) Can someone point out what I am doing wrong?
November 2nd, 2010 2:23pm

(DT_WSTR,4)(Year(DATEADD("mm", 1, (DT_DATE)(SUBSTRING(@[User::strVar],1,4)+"-"+SUBSTRING(@[User::strVar],5,2)+"-01") )))+ RIGHT("0"+(DT_WSTR,2)(Month(DATEADD("mm", 1, (DT_DATE)(SUBSTRING(@[User::strVar],1,4)+"-"+SUBSTRING(@[User::strVar],5,2)+"-01") ))),2) http://www.rad.pasfu.com
Free Windows Admin Tool Kit Click here and download it now
November 2nd, 2010 2:32pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics