How to convert datetime to string format (YYYYMMDD) in SSIS?

  • How to convert datetime to string format (YYYYMMDD) in SSIS?

    I have done using Datepart but for the date 01 to 09 it gives the values as 1 to 9. I need values should be as 01. Anybody guide me

  • Not sure how to do it in SSIS but in T-SQL:

    CONVERT(VARCHAR(8),MyDateCol, 112)

    Can you convert it prior to SSIS doing its thing?

  • karthick.alangattan (2/27/2013)


    How to convert datetime to string format (YYYYMMDD) in SSIS?

    I have done using Datepart but for the date 01 to 09 it gives the values as 1 to 9. I need values should be as 01. Anybody guide me

    You can get round the issue you mentioned by doing something like this (untested):

    right("0" + Datepart(...), 2)

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Here's another option.

    REPLACE((DT_WSTR, 10)(DT_DBDATE)GETDATE(),"-","")

  • kl25 (2/28/2013)


    Here's another option.

    REPLACE((DT_WSTR, 10)(DT_DBDATE)GETDATE(),"-","")

    Good stuff - this is the way to go.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply