By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,165 Members | 840 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,165 IT Pros & Developers. It's quick & easy.

Access query Help..

P: n/a
Hi,

How to get the value as 0 insted of NULL if there is no data found in
the database for a particular column in the following Access query.

select col1, col2 from tab1;

If there are null values in col1 or col2, the query should return 0
instead of null. Please send me the modified query for the above.

appreciate your help

Regards,
Omav
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Omavlana a ecrit, Le 15/04/2004 09:46 :
Hi,

How to get the value as 0 insted of NULL if there is no data found in
the database for a particular column in the following Access query.

select col1, col2 from tab1;

If there are null values in col1 or col2, the query should return 0
instead of null. Please send me the modified query for the above.

appreciate your help

Regards,
Omav

select Iif(Isnull(col1)),0,col1), Iif(col2,Isnull(col2)),0,col2) from tab1;
Nov 12 '05 #2

P: n/a
NoMail <No****@nomail.com> wrote in message news:<c5*********@news.rd.francetelecom.fr>...
Omavlana a ecrit, Le 15/04/2004 09:46 :
Hi,

How to get the value as 0 insted of NULL if there is no data found in
the database for a particular column in the following Access query.

select col1, col2 from tab1;

If there are null values in col1 or col2, the query should return 0
instead of null. Please send me the modified query for the above.

appreciate your help

Regards,
Omav

select Iif(Isnull(col1)),0,col1), Iif(col2,Isnull(col2)),0,col2) from tab1;

or you can use the NZ function built into Access.

SELECT nz([col1],0), nz([col2],0)FROM tab1;
Nov 12 '05 #3

P: n/a
Or you can set the Default value for the fields in col1 and col2 in the table to
0.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"dgs5150" <dg*****@yahoo.com> wrote in message
news:52**************************@posting.google.c om...
NoMail <No****@nomail.com> wrote in message

news:<c5*********@news.rd.francetelecom.fr>...
Omavlana a ecrit, Le 15/04/2004 09:46 :
Hi,

How to get the value as 0 insted of NULL if there is no data found in
the database for a particular column in the following Access query.

select col1, col2 from tab1;

If there are null values in col1 or col2, the query should return 0
instead of null. Please send me the modified query for the above.

appreciate your help

Regards,
Omav

select Iif(Isnull(col1)),0,col1), Iif(col2,Isnull(col2)),0,col2) from tab1;

or you can use the NZ function built into Access.

SELECT nz([col1],0), nz([col2],0)FROM tab1;

Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.