Invalid operator for data type

Posted on 2006-03-24
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.

Question by:pansophy
LVL 143

Accepted Solution

Guy Hengel [angelIII / a3] earned 2000 total points
ID: 16281223
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


Expert Comment

ID: 16281263
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
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 16281294
Only integer vales are permissible for bitwise operations

for eg :
SELECT 234^(10)

SELECT 234^(10.0) --wont work

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question