Link to home
Start Free TrialLog in
Avatar of pansophy
pansophy

asked on

Invalid operator for data type

SELECT     ID, CASE WHEN Gender = 1 THEN (170 * Creatine ^ (- 0.999)
                      * Age^ (- 0.176) * BUN^ (- 0.17) * Alb^ 0.318)
                       END AS GFR
FROM         SAH_Master.dbo.ftblHC_HCC

This produces the error: "Invalid operator for data type.  Operator equals boolean XOR, type equals real.

I'm not sure what this error means and whether I can handle this within the query or if I need to change the data type of the fields themselves in order to do these calculations.

thanks.
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pjdee
pjdee

from BOL

The ^ bitwise operator can be used only on columns of the integer data type category.

i guess one of your fields is a real and will need converting?

if not please post the definitaion of table ftblHC_HCC
Only integer vales are permissible for bitwise operations

for eg :
SELECT 234^(10)

SELECT 234^(10.0) --wont work