SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 expression to get the last year derived column
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

shanmugaraj
Posting Yak Master

219 Posts

Posted - 08/04/2014 :  06:58:24  Show Profile  Send shanmugaraj a Yahoo! Message  Reply with Quote
Need have the expression to get the last year same month of the getdate() in derived column

I am trying with

(DT_STR,4,1252)DATEPART("yyyy",GETDATE()) + RIGHT("0" + (DT_STR,2,1252)DATEPART("mm",GETDATE()),2)

current result 201408
expected result 201308

THANKS
SHANMUGARAJ
nshanmugaraj@gmail.com

shanmugaraj
Posting Yak Master

219 Posts

Posted - 08/04/2014 :  08:06:48  Show Profile  Send shanmugaraj a Yahoo! Message  Reply with Quote
(DT_STR,4,1252)(DATEPART("yyyy",GETDATE()) - 1) + RIGHT("0" + (DT_STR,2,1252)DATEPART("mm",GETDATE()),2)


THANKS
SHANMUGARAJ
nshanmugaraj@gmail.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000