how to select getdate() into a string variable in YYYY-MM-dd format

  • hi

    i am facing very small issue ,,

    i have a variable of String Type in a SSIS package .

    now i want to assign that string variable with the Current date in the formate "yyyy-MM-dd" within Execute Sql Task by using Sql statement..

    say my variable is " vstrDate",, now when my package will run then this variable be asssigned with Startdate of package within this format "yyyy-MM-dd" . i want to assign this variable in the control flow-Execute Sql Task.

    this variable is useredefined ,,which will be passed in another Query/Sql statements as string with the contents of date..

    Please help...

  • This probably belongs in the SSIS 2005 forum?

    http://www.sqlservercentral.com/Forums/Forum148-1.aspx

    SQLServerNewbieMCITP: Database Administrator SQL Server 2005
  • i want to assign that string variable with the Current date in the formate "yyyy-MM-dd" within Execute Sql Task by using Sql statement..

    Try something like this:

    declare @vstrDate as char(10)

    select @vstrDate = convert(char(10), getdate(), 121)

    select @vstrDate

    2008-12-11

Viewing 3 posts - 1 through 2 (of 2 total)

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