When adding this line into my query:
convert(varchar(20), convert(varchar(20),
sum(case when tsr.other like '%aa%' then tsr.block1 else 0 end) +
sum(case when tsr.other like '%aa%' then tsr.block2 else 0 end) +
sum(case when tsr.other like '%aa%' then tsr.block3 else 0 end) +
sum(case when tsr.other like '%aa%' then tsr.block4 else 0 end)) * 450)
I get this error message:
Conversion failed when converting the varchar value '0.00' to data type int
Data in block column is days - e.g. 10.0
Any ideas?
i've got it fixed, it was just changing the 450 to 450.0.
The reason for the varchars is that this is just 1 line from 1 of multiple unioned select statements.
VARCHARthen multiplying it by450??? Surely, surely, if anything you should be explicity casting strings to numerics, not the other way around? - MatBailie