title: Convert string variable to GUID
body: <p>I want to use an <code>Execute SQL Task</code> query to return <code>varbinary</code> data from a database table. The query requires a <code>UniqueIdentifier</code> as a <strong>parameter</strong> which is stored as <code>string</code> in a Package variable. The result of this query (the varbinary data) will be stored in a second variable of type Byte.</p>
  
  <p>The table below shows my list of local variables, note that DocumentGuid is pre-populated by another part of control flow</p>
  
  <pre><code>| Variable Name | Qualified Name     | Scope   | Data Type | Comments                                 |
  |---------------|--------------------|---------|-----------|------------------------------------------|
  | DocumentGuid  | User::DocumentGuid | Package | String    | Used to store a GUID value               |
  | DocumentData  | User::DocumentData | Package | Byte      | Used to hold varbinary data from a query |
  </code></pre>
  
  <p>When I try to use this in a <code>Execute SQL Task</code> query like this: </p>
  
  <pre><code>SELECT DocData 
  FROM  docsRepo
  WHERE DocumentGuid = ?
  </code></pre>
  
  <p>Passing in the parameters as </p>
  
  <pre><code>| Variable name      | Direction | Data Type | Parameter Name | Parameter Size |
  |--------------------|-----------|-----------|----------------|----------------|
  | User::DocumentGuid | Input     | GUID      | 0              | 100            |
  </code></pre>
  
  <p>And Result Set</p>
  
  <pre><code>| Result Name | Variable Name      |
  |-------------|--------------------|
  | DocData    | User::DocumentData |
  </code></pre>
  
  <p>I get the following error:</p>
  
  <blockquote>
    <p>[Execute SQL Task] Error: Executing the query "SELECT DocData FROM<br>
    dbo.docsRepo..." failed with the following error: "Conversion failed
    when converting from a character string to uniqueidentifier.".
    Possible failure reasons: Problems with the query, "ResultSet"
    property not set correctly, parameters not set correctly, or
    connection not established correctly.</p>
  </blockquote>
  
  <p>Am I missing some kind of fundamental logic here? The following script works just fine in SQL Server:</p>
  
  <pre><code>SELECT DocData 
  FROM  docsRepo
  WHERE DocumentGuid = '53A394A7-5D2B-40C0-A04D-90553E4535C3'
  </code></pre>