Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

return 0 when null

Status
Not open for further replies.

Bell1991

Programmer
Aug 20, 2003
386
US
I need a query that will return 0 if the value is null - but also return that column name.

I have this query:

SELECT IIf(IsNull(numCost),0, numCost)
From tblTable;

But it does not come back to me as numCost - it comes back as someother column name. Also, in my query i am returning many more columns that just one

Any suggestions?

Thanks in advance
 
You need
Code:
SELECT IIf(IsNull(numCost),0, numCost) [COLOR=red]As [NumCost][/color]
From tblTable;
You may also try
Code:
SELECT NZ(numCost,0) [COLOR=red]As [NumCost][/color]
From tblTable;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top