none
SSIS Expression for : First Day of the last month

    Question

  • Could you please give me the SSIS expression for first day of last month.

    Format: mmddyyyy

    Thanks in advance


    s

    Tuesday, May 28, 2013 9:37 PM

Answers

  • LEFT("0" + (DT_WSTR, 8)((MONTH(DATEADD("mm", -1, GETDATE())) * 1000000) 
    + 10000 + YEAR(DATEADD("mm", -1,GETDATE()))), 8)


    Russel Loski, MCT, MCSA SQL Server 2012, 2008, MCITP Business Intelligence Developer and Database Developer 2008 Twitter: @sqlmovers; blog: www.sqlmovers.com


    Tuesday, May 28, 2013 11:09 PM
  • Following SSIS exp worked for me, as I am using 2005 SQL server LEFT fn is not available.

    substring("0" + (DT_WSTR, 8) ((MONTH(DATEADD("mm", -1, GETDATE())) * 1000000)
    + 10000 + YEAR(DATEADD("mm", -1,GETDATE()))), 1,8)


    s

    • Marked as answer by santhosh437 Wednesday, May 29, 2013 1:34 PM
    Wednesday, May 29, 2013 1:34 PM

All replies

  • LEFT("0" + (DT_WSTR, 8)((MONTH(DATEADD("mm", -1, GETDATE())) * 1000000) 
    + 10000 + YEAR(DATEADD("mm", -1,GETDATE()))), 8)


    Russel Loski, MCT, MCSA SQL Server 2012, 2008, MCITP Business Intelligence Developer and Database Developer 2008 Twitter: @sqlmovers; blog: www.sqlmovers.com


    Tuesday, May 28, 2013 11:09 PM
  • Following SSIS exp worked for me, as I am using 2005 SQL server LEFT fn is not available.

    substring("0" + (DT_WSTR, 8) ((MONTH(DATEADD("mm", -1, GETDATE())) * 1000000)
    + 10000 + YEAR(DATEADD("mm", -1,GETDATE()))), 1,8)


    s

    • Marked as answer by santhosh437 Wednesday, May 29, 2013 1:34 PM
    Wednesday, May 29, 2013 1:34 PM