|
Posted by Hugo Kornelis on 10/02/88 11:45
On Thu, 20 Apr 2006 20:25:47 GMT, "Rico" <r c o l l e n s @ h e m m i n
g w a y . c o mREMOVE THIS PART IN CAPS> wrote:
>I'm moving some queries out of an Access front end and creating views out of
>them in SQL Server 2005 express. In some of the numeric fields, I use nz
>quite often, ( i.e. nz([MyField],0)) to return a zero if the field is null.
>Is there anything equivalent to this in SQL Server? Right now I'm using
>CASE WHEN ... but it seems like an awful lot of script to write just to
>replace null with a zero.
>
>Any help would be greatly appreciated.
>
>Thanks!
>
Hi Rico,
Use COALESCE:
COALESCE (arg1, arg2, arg3, arg4, ...)
returns the first non-NULL of the supplied arguments. You need at least
two arguments, but you can add as many as you like.
--
Hugo Kornelis, SQL Server MVP
Navigation:
[Reply to this message]
|