We help IT Professionals succeed at work.

Invalid operator for data type

pansophy
pansophy asked
on
Medium Priority
295 Views
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.

thanks.
Comment
Watch Question

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

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_pa-pz_033m.asp

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

Ask the Experts

Commented:
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
CERTIFIED EXPERT
Top Expert 2009

Commented:
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.

OR

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.