Hi,
I am trying to do some simple math for a report and it works fine in vs2012 and in the Telerik Reporting SQLDataSource when I execute the query.
However I cannot access the results because the Data Explores gives me the following error.
System.Data.SqlClient.SqlException (0x80131904): Operand data type nvarchar is invalid for subtract operator.
Here is the code:
SELECT
CASE
WHEN (@RowsTotal IS NULL OR
@RowsTotal = 0) THEN 0
ELSE ((@Rows1 + @Rows2 + @Rows4) * 1.0/ (@RowsTotal - @Rows8)) * 1.0
END AS 'Permanency Discharges %'
, CASE
WHEN (@RowsTotal IS NULL OR
@RowsTotal = 0) THEN 0
ELSE ((@Rows6 + @Rows7) *1.0 / (@RowsTotal) *1.0)
END AS 'Insufficient Resources %'
All of the variables are initiated as a float in SQL but as a double in Telerik Reporting.
The values of the variables are:
@Rows1 = 5
@Rows2 = 11
@Rows4 = 12
@Rows6 = 2
@Rows7 = 7
@Rows8 = 2
@RowsTotal = 47
If I replace the variables in the SQL with their values it works in Telerik Reporting.
Any help is greatly appreciated.
Andy