title: SSIS 2008 Execute SQL output parameter mapping datetime2 problem
body: <p>I'm trying to use an Execute SQL Task in SSIS 2008 to map a store procedure output parameter to a package variable.</p>
  
  <p>The package variable is SSIS type DateTime and the store procedure parameter is SQL type DATETIME.</p>
  
  <p>The SQL Statement is <code>EXEC GetCurrentDate @CurrentDate=?</code> and in the parameter mapping screen, the parameter is mapped to the package variable with direction Output and Data Type DBTIMESTAMP specified.</p>
  
  <p>When I run the package I get the following error:</p>
  
  <blockquote>
    <p>[Execute SQL Task] Error: Executing
    the query "EXEC GetCurrentDate
    @CurrentDate=? " failed with the
    following error: "The type of the
    value being assigned to variable
    "User::CurrentDate" 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.</p>
  </blockquote>
  
  <p>If I run a trace on the query being run I see the type is being assumed as datetime2:</p>
  
  <pre><code>declare @p3 datetime2(7)
  set @p3=NULL
  exec sp_executesql N'EXEC GetCurrentDate @CurrentDate=@P1 ',N'@P1 datetime2(7) OUTPUT',@p3 output
  select @p3
  </code></pre>
  
  <p>Does anyone know why it is assuming the type is datetime2?</p>
  
  <p>Thanks</p>