View Works in SQL2005 but not SQL2008 with Cast and Round Function
Posted on 2013-02-01
Migrating from SQL2005 to SQL2008 and working on views I have a table called ANALOG in a database called SCADA there is also another table called displayfactors. Values in Analog with the VALUE column comes in as a VARCHAR. In DisplayFactors table the data is numeric(18,6).
Here is current View in SQL2005:
SELECT dbo.ANALOG.STATION, dbo.df_table.STATION AS DFSTATION, dbo.ANALOG.VALUE, dbo.df_table.DF, dbo.ANALOG.NAME, ROUND(CAST(dbo.ANALOG.VALUE AS FLOAT)
* (dbo.df_table.DF * 1000), 2) AS KVALUE, ROUND(CAST(dbo.ANALOG.VALUE AS FLOAT) * dbo.df_table.DF, 2) AS TVALUE
FROM dbo.ANALOG CROSS JOIN
Once again this works in SQL2005.
Error I get is Conversion failed when converting the nvarchar value '.00720' to data type int.
All data in Value field on ANALOG is numbers. Some numbers as 23456