title: Conversion failed when converting the nvarchar value to data type int
body: <p>Do you know what could be wrong here?</p>
  
  <p>All variables are nvarchar.
  The error occurs when @FunctionValue contains an INT in string format.</p>
  
  <pre><code>IF @TargetType = 'INT'
  BEGIN
      SELECT @SQLSTR = 'UPDATE ' + @TargetTable + 
                          ' SET ' + @TargetColumn + ' = ' + COALESCE(CAST(@FunctionValue AS INT), CAST(@Value AS INT)) + 
                           ' '
  END
  </code></pre>