August 3, 2010 at 7:27 am
Hi
I am new at SQL, so pls bear with me. How do I correct my code below
select '1' [union] ,type,SHORTHAND,num,denom,[current],past,round([current]-past,1) current_past,
round((2.0*num+power(3.0902,2)-3.0902*SQRT(power(3.0902,2)+4.0*num*(1-[current])))/(2.0*(denom+power(3.0902,2))),6) lower_l2,
round((2.0*num+power(3.0902,2)+3.0902*SQRT(power(3.0902,2)+4.0*num*(1-[current])))/(2.0*(denom+power(3.0902,2))),6) upper_l2,
Peer_Max,Peer_Min,quarter
I keep getting this message Msg 3623, Level 16, State 1,A domain error occurred.
Warning: Null value is eliminated by an aggregate or other SET operation.
August 4, 2010 at 3:39 am
write the complete query
August 4, 2010 at 6:20 am
niyinks (8/3/2010)
HiI am new at SQL, so pls bear with me. How do I correct my code below
select '1' [union] ,type,SHORTHAND,num,denom,[current],past,round([current]-past,1) current_past,
round((2.0*num+power(3.0902,2)-3.0902*SQRT(power(3.0902,2)+4.0*num*(1-[current])))/(2.0*(denom+power(3.0902,2))),6) lower_l2,
round((2.0*num+power(3.0902,2)+3.0902*SQRT(power(3.0902,2)+4.0*num*(1-[current])))/(2.0*(denom+power(3.0902,2))),6) upper_l2,
Peer_Max,Peer_Min,quarter
I keep getting this message Msg 3623, Level 16, State 1,A domain error occurred.
Warning: Null value is eliminated by an aggregate or other SET operation.
Somewhere along the line, the value used for the power function is resulting either in a negative number or 0. You need to find that problem in the data and have your code compensate for that eventuality.
--Jeff Moden
Change is inevitable... Change for the better is not.
August 4, 2010 at 6:53 am
where is the "from" clause of your query.
if you want me to help you write the whole query.
you see 'select ' query is in this form:
Select a,b,c,... from tableName
August 5, 2010 at 12:32 am
Have a look at http://www.sql-server-performance.com/faq/domain_error_occurred_p1.aspx
Try running your query with only the content of the SQRT i.e. power(3.0902,2)+4.0*num*(1-[current]) and see if you can identify the problem with yor data.
August 5, 2010 at 3:46 am
Ok
I assume you have a null value in your database so it causes that
aggregate functions to fail.the best and correct way is to use 'Isnull'
function to eliminate null value the second and easy way is to
use the following statement at the beginning of your query but the first way is better .
set ANSI_WARNINGS OFF
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply