We help IT Professionals succeed at work.

Invalid operator for data type

pansophy asked
Medium Priority
Last Modified: 2008-03-03
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.

Watch Question

Billing Engineer
Most Valuable Expert 2014
Top Expert 2009
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


Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

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
AneeshDatabase Consultant
Top Expert 2009

Only integer vales are permissible for bitwise operations

for eg :
SELECT 234^(10)

SELECT 234^(10.0) --wont work
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.