Re: NZ Function?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Dan Guzman (guzmanda_at_nospam-online.sbcglobal.net)
Date: 12/06/04


Date: Mon, 6 Dec 2004 08:26:39 -0600

You can use COALESCE or ISNULL:

SELECT COALESCE(MyColumn, 0) AS MyColumn
FROM MyTable

SELECT ISNULL(MyColumn, 0) AS MyColumn
FROM MyTable

-- 
Hope this helps.
Dan Guzman
SQL Server MVP
"Joe Williams" <JOE@ANYWHERE.com> wrote in message 
news:eFbmT752EHA.3236@TK2MSFTNGP15.phx.gbl...
> hi,
>
> In Access I can use the NZ() function to convert null fields to zero in a 
> SQL select statement. I put it in a SQL view and I get an unknown function 
> error. How do I do it in SQL and can you give me an example? Thanks!
>
> Joe
> 


Relevant Pages

  • Re: Avg() not including 0s
    ... I have a sql query like this ... order by [mycolumn] desc ... But sql is returning a value as if my 0's were nulls and not factored ... My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis ...
    (comp.databases.ms-sqlserver)
  • Re: Avg() not including 0s
    ... order by [mycolumn] desc ... But sql is returning a value as if my 0's were nulls and not factored ... If the problem persists, then please post a repro script and the version ...
    (comp.databases.ms-sqlserver)
  • default constraint
    ... is there any SQL that can be fired off against Access that will cause it to ... alter table mytable add constraint myconstraint default for mycolumn ... either over ADO or within Access. ...
    (microsoft.public.vb.general.discussion)
  • default constraint
    ... is there any SQL that can be fired off against Access that will cause it to ... alter table mytable add constraint myconstraint default for mycolumn ... either over ADO or within Access. ...
    (microsoft.public.sqlserver.programming)
  • default constraint
    ... is there any SQL that can be fired off against Access that will cause it to ... alter table mytable add constraint myconstraint default for mycolumn ... either over ADO or within Access. ...
    (microsoft.public.access.modulesdaovba)