title: SQL Conversion failed when converting the varchar value '*' to data type int
body: <p><em>Aside: Please note that this is not a duplicate of the countless other string-to-int issues in sql. This is a specific cryptic error message (with the asterisk) that hides another problem</em> </p>
  
  <p>Today I came across an issue in my SQL that took me all day to solve. I was passing a data table parameter into my stored procedure and then inserting part of it into another table. The code used was similar to the following:</p>
  
  <pre><code>INSERT INTO tblUsers
      (UserId,ProjectId) 
  VALUES ((SELECT CAST(CL.UserId AS int) FROM @UserList AS UL),@ProjectId)
  </code></pre>
  
  <p>I didn't seem to get the error message when using test data, only when making the call from the dev system. </p>
  
  <p>What is the issue and how should the code look?</p>