Home Forums SQL Server 2005 Business Intelligence How to assign user variable a GUID value in Execute SQL Task using SSIS 2008 RE: How to assign user variable a GUID value in Execute SQL Task using SSIS 2008

  • patelmia (7/28/2011)


    Thanks for your prompt reply.

    You are correct spt_key in temptable is a uniqueidentifier column. Since there is no datatype as guid during variable creation I picked string. I want it to be stored in guid and use it further. Please let me know how can i acheive it.

    will declaring user variable user::spt_key as an object and converting it to guid in script task works. if so do you have any example.

    appreciate your time.

    Use the variable type of Object to catch the result from the database if you want the UNIQUEIDENTIFIER available in its binary form in SSIS, i.e. usable as a true GUID and cast-able in SSIS to a DT_GUID type in an expression. This is probably not what you want.

    Use the variable type of String to catch the result from the database and CAST the UNIQUEIDENTIFIER to a VARCHAR as I have it in my previous post if you want to use it in string concatenation in expressions and scripts. This is more likely what you want.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato