July 28, 2014 at 6:56 am
In My derived column I want expression for getting yyyymm ( where mm is mm-1)
Expression in Derived Column
(DT_STR,4,1252)DATEPART("yyyy",GETDATE()) + RIGHT("0" + (DT_STR,2,1252)DATEPART("mm",GETDATE()),2)
Result : 201407
Expected Result : 201406
July 28, 2014 at 7:11 am
Shanmuga Raj (7/28/2014)
In My derived column I want expression for getting yyyymm ( where mm is mm-1)Expression in Derived Column
(DT_STR,4,1252)DATEPART("yyyy",GETDATE()) + RIGHT("0" + (DT_STR,2,1252)DATEPART("mm",GETDATE()),2)
Result : 201407
Expected Result : 201406
Try this:
(DT_STR,4,1252)DATEPART("yyyy",DATEADD("Month",-1,GETDATE())) + RIGHT("0" + (DT_STR,2,1252)DATEPART("mm",DATEADD("Month",-1,GETDATE())),2)
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy