Populating DateTime variable from Execute SQL task | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Populating DateTime variable from Execute SQL task

Please help! I am designing an SSIS package and need to change the value of a DateTime global variable with the value returned from an Execute SQL task. The queary is as follows: Select Versiondate = dateadd(dd,+1,Max(CreateDate)) from msdb..sysdtspackages p with(nolock)
where name = ‘@name’ The error message is as follows: SSIS package "Package.dtsx" starting. Error: 0xC002F210 at VersionDate_Set, Execute SQL Task: Executing the query "Select Versiondate = dateadd(dd,+1,Max(CreateDate)) from msdb..sysdtspackages p with(nolock) where name = ‘@name’" failed with the following error: "The type of the value being assigned to variable "User::VersionDate" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object. ". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. Task failed: VersionDate_Set SSIS package "Package.dtsx" finished: Success. The variable is set to data type DateTime, but the value will not change. Any ideas?

May checkhttp://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=771167&SiteID=1 lnk. Satya SKJ
Microsoft SQL Server MVP
Contributing Editor & Forums Moderator
http://www.SQL-Server-Performance.Com
This posting is provided AS IS with no rights for the sake of knowledge sharing.
]]>