Coalesce returns the first non-null value. So if Quarter is valid then it
returns quarter but if it is null then colesce will return '2002-Q1'
instead.
Brian
-----Original Message-----
From: Fatos ocak [mailto:tetene@y...]
Sent: Wednesday, December 18, 2002 11:58 AM
To: sql language
Subject: [sql_language] RE: Plz Help!!!How can I make this code work in
MSSQL Server?
Thanks alot!! This works!!! But I am really confused
as to how it is working. my original code is basically
saying that if quarter is null, put 2002-Q otherwise
leave it as it is. I read sth about coalesce function
and it says some call it if not null function. If it
is so, basically in that arguement are we saying if
quarter is not null, replace it with '2002-Q1????????
Thanks in advance
--- Jeff Mason <je.mason@a...> wrote:
> The COALESCE function will allow you to code the
> equivalent of what you are
> doing in Access. COALESCE returns the first nonnull
> value in its list of
> arguments:
>
> COALESCE(Quarter,'2002-Q1') AS Q,
> COALESCE(SumOfSumOfBillable_Hours,0) AS
> BillableHours,
> COALESCE(Standard_Time,0) AS StandardHours,
> etc...
>
> P.S. I couldn't resist changing the column aliases
> to something without
> embedded spaces. Embed your spaces in your
> presentation layer, not in your
> database column names...
> --
> Jeff Mason Custom Apps, Inc.
> Jeff@c...
>
>
> -----Original Message-----
> From: Fatos ocak [mailto:tetene@y...]
> Sent: Tuesday, December 17, 2002 5:01 PM
> To: sql language
> Subject: [sql_language] Plz Help!!!How can I make
> this code work in
> MSSQL Server?
>
>
> This is the code in Acess. Can someone tell me how
> to
> replicate this code in MSSQL server? It says iif
> function is not recognized, and also isnull function
> requires two arguements:(
>
> Thanks in advance
>
> IIf(IsNull([Quarter]),"2002-Q1",[Quarter]) AS Q,
>
IIf(IsNull([SumOfSumOfBillable_Hours]),0,[SumOfSumOfBillable_Hours])
> AS [Billable Hours],
> IIf(IsNull([Standard_Time]),0,[Standard_Time]) AS
> [Standard Hours],
> IIf(IsNull([Assigned_Time]),0,[Assigned_Time]) AS
> [Assigned Hours]
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up
> now.
> http://mailplus.yahoo.com
>
>
>
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com