title: SSIS - How do I use a resultset as input in a SQL task and get data types right?
body: <p>I am trying to merge records from an Oracle database table to my local SQL table.  </p>
  
  <p>I have a variable for the package that is an Object, called OWell.</p>
  
  <p>I have a data flow task that gets the Oracle data as a SQL statment (select well_id, well_name from OWell order by Well_ID), and then a conversion task to convert well_id from a DT_STR of length 15 to a DT_WSTR; and convert well_name from a DT_STR of length 15 to DT_WSTR of length 50.  That is then stored in the recordset OWell.</p>
  
  <p>The reason for the conversions is the table that I want to add records to has an identity field: SSIS shows well_id as a DT_WSTR of length 15, well_name a DT_WSTR of length 50.</p>
  
  <p>I then have a SQL task that connects to the local database and attempts to add records that are not there yet.  I've tried various things: using the OWell as a result set and referring to it in my SQL statement.  Currently, I have the ResultSet set to None, and the following SQL statment: </p>
  
  <pre><code>Insert into WELL (WELL_ID, WELL_NAME)
  Select OWELL_ID, OWELL_NAME
  from OWell
  where OWELL_ID not in 
     (select WELL.WELL_ID from WELL)
  </code></pre>
  
  <p>For Parameter Mapping, I have Paramater 0, called OWell_ID, from my variable User::OWell.  Parameter 1, called OWell_Name is from the same variable.  Both are set to VARCHAR, although I've also tried NVARCHAR.  I do not have a Result set.</p>
  
  <p>I am getting the following error:
  Error: 0xC002F210 at Insert records to FLEDG, Execute SQL Task: Executing the query "Insert into WELL (WELL_ID, WELL_NAME)
  Select OWELL..." failed with the following error: "An error occurred while extracting the result into a variable of type (DBTYPE_STR)". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.</p>
  
  <p>I don't think it's a data type issue, but rather that I somehow am not using the resultset properly.  How, exactly, am I supposed to refer to that recordset in my SQL task, so that I can use the two recordset fields and add records that are missing?</p>