Monday, March 26, 2012

PackageID and GUIDs in ExecuteSQL task

Am I looking at a potential bug here or do I not understand the feature properly? I have an ExecuteSQL task that inserts into a table for logging and includes the System::PackageID as one of the values. It's stored in my table as a uniqueidentifier. When I set the output variable in Parameter Mappings tab of the Execute SQL task to VarChar, all works great. WHen I set it to GUID as the data type in that tab, it outputs a different GUID than the actual System::PackageID variable.

-- Brian

This is not a bug, although several have thought it was. If you look at the system variable you will notice that even though it looks like a GUID the type of the variable is a string. This is why when you set the SQL task to use a string type it shows the correct value. However, when you set to GUID you don't get the value you expect because the SQL Task doesn't perform conversion for you so the value being placed in your uid field is actually a guid representation of the pointer not that GUID that is pointed to. Currently, if you want to set the GUID into a uid field in SQL I believe you need to use a script task because then you can get the conversion you expect.

HTH,

Matt

No comments:

Post a Comment