title: Error converting data type nvarchar to float with dynamic T-SQL
body: <p>Why am I getting a conversion error? I'm not even converting anything and even when debugging the code I can't figure out what the issue is.</p>
  
  <pre><code>DECLARE @pTbl NVARCHAR(20) = 'tblTPS'
  DECLARE @sMD FLOAT = 3.3333333300000e-001
  DECLARE @sIQ FLOAT = 000000000000.000e+000
  
  SET @SQL ='UPDATE ' + @pTbl + ' SET fldND = (CASE WHEN fldND &lt; ('+@sMD+' - (2 * 
            '+@sIQ+')) 
            THEN '+@sMD+' - (2 * '+@sIQ+') ELSE
            (CASE WHEN fldND &gt; ('+@sMD+'+(2 * '+@sIQ+')) THEN '+@sMD+' + (2 *  
           '+@sIQ+')END)END)'
  
  EXEC @SQL
  </code></pre>