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.

Who is Participating?
Guy Hengel [angelIII / a3]Billing EngineerCommented:
SELECT     ID, CASE WHEN Gender = 1 THEN (170 * POWER( Creatine , - 0.999)
                      * POWER ( Age , - 0.176) * POWER ( BUN, - 0.17) * POWER ( Alb, 0.318)
                       END AS GFR
FROM         SAH_Master.dbo.ftblHC_HCC
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
Aneesh RetnakaranDatabase AdministratorCommented:
Only integer vales are permissible for bitwise operations

for eg :
SELECT 234^(10)

SELECT 234^(10.0) --wont work
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.