title: Conversion failed when converting the varchar value '6276.54' to data type int
body: <p>I have the below query that keeps throwing the conversion error. I have tried so many ways of making this work but still get the same error. Process of elimination I'm now thinking that this is to do with the hard coded 0.715 value. I'm not sure if or how I force this to be a decimal or if its better to have this SET and a variable at the beginning of my code. </p>
  
  <pre><code>SELECT  CAST(DATEPART(yyyy, YEAR) as INT) AS YEAR, 
          COUNT(ID) AS ID,
          SUM(VALUE) AS VALUE,
          SUM(PREMIUM) AS PREMIUM,
          SUM(try_convert(float,USERID1)) AS VALUE1,
          COALESCE(SUM(PREMIUM)/(SUM(try_convert(float,NULLIF(USERID1,0)))*0.715),0) AS 'PROFIT'
          SUM(CAST(USERID1 AS float))/SUM(PREMIUM) AS 'PROFIT%'
  
  INTO #YEAR_VALUE
  
  FROM #DATA LT
  
  INNER JOIN dbo.AccountDB P ON LT.ID = P.ID
  
  GROUP BY INCEPTDATE
  </code></pre>
  
  <p>Any help would be much appreciate.</p>
  
  <p>Thanks in advance</p>