Re: Weird SQL server select behaviour ..

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Tibor Karaszi (tibor_please.no.email_karaszi_at_hotmail.nomail.com)
Date: 06/04/04


Date: Fri, 4 Jun 2004 14:21:42 +0200

Did you notice the warning message?:
"A domain error occurred."

Also, look into SET ARITHABORT. See below:

set arithabort off

select val, log(-val) as badlog from numbers

-- 
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Luke" <Luke@no.where> wrote in message news:ed61c1iSEHA.240@TK2MSFTNGP11.phx.gbl...
> Note 1 to 4 is all simply what I expected, 5 is not:
>
> 1) Create a table
>
> create table numbers ( val int )
>
> 2) Insert some datta
> insert numbers values ( val ) values (1)
> insert numbers values ( val ) values (13)
> insert numbers values ( val ) values (19)
>
> 3) select the data
>
> select * from numbers
>
> val
> ---
> 1
> 13
> 19
>
> 4) select data and a valid calculated column
>
> select val, val*2 as valx2 from numbers
>
> val   valx2
> ----  ----
> 1      2
> 13   26
> 19  38
>
> 5) select data and a  calculated column that calls a function with an valid
> parameter, e.g. log(n) where n < 0
>
> select val, log(-val) as badlog from numbers
>
> val   badlog
> ----  ----
>
>
> ... empty resultset !!!!
>
> Also select log(-1) does NOT return an error, only noting.
>
>
>