Convert 'select getdate()' to a string in SSIS ?

  • I am not able to convert SSIS get date to sql server datetime format. I saw some error which i don't remember. anyway, so i decided to execute sql and get current date as "select getdate()" (Will alias AS TODAYS_DATE work in SSIS ?). After that, I want to convert this date into a string using script task. How do I do it ?

  • Why are you not using SSIS functions for date expressions?

    Raunak J

  • Create a SSIS variable and build an expression and use appropriate CAST functions

    Raunak J

  • blasto_max (10/28/2013)


    I am not able to convert SSIS get date to sql server datetime format. I saw some error which i don't remember. anyway, so i decided to execute sql and get current date as "select getdate()" (Will alias AS TODAYS_DATE work in SSIS ?). After that, I want to convert this date into a string using script task. How do I do it ?

    As Raunak has implied with his questions, it might be better if you describe what you are trying to do, as there may be a better way of achieving your aim.

    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.

  • in script manager you can do this:

    datecol.ToString("yyyyMMdd");

    Please note Format can change.

    you need to generate a new column from the script manager and use that column in the ssis package.

    Hope its helps

  • Okay, this is what I want to do -

    Select getDate() from execute SQL -> Load this result set to recordset ABC -> Read ABC and put it into a string variable. By this approach, you don't need to do any conversions. If you try to stuff an SSIS DateTime into an SQL server datetime, you will get an error. With my method, this is avoided.

    Makes sense ?

  • SSIS will assign "DT_DBTIMESTAMP" for a DateTime data type.

    so if in the Destination Table you u have a DateTime column then it will map with and data will be inserted without any issue ... !!!!

Viewing 7 posts - 1 through 6 (of 6 total)

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