Access query Help..

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Omavlana

    Access query Help..

    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
  • NoMail

    #2
    Re: Access query Help..

    Omavlana a ecrit, Le 15/04/2004 09:46 :
    [color=blue]
    > 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[/color]


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

    Comment

    • dgs5150

      #3
      Re: Access query Help..

      NoMail <NoMail@nomail. com> wrote in message news:<c5loog$e0 i1@news.rd.fran cetelecom.fr>.. .[color=blue]
      > Omavlana a ecrit, Le 15/04/2004 09:46 :
      >[color=green]
      > > 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[/color]
      >
      >
      > select Iif(Isnull(col1 )),0,col1), Iif(col2,Isnull (col2)),0,col2) from tab1;[/color]


      or you can use the NZ function built into Access.

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

      Comment

      • PC Datasheet

        #4
        Re: Access query Help..

        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
        resource@pcdata sheet.com



        "dgs5150" <dgs5150@yahoo. com> wrote in message
        news:526ed05a.0 404150652.2c077 c4f@posting.goo gle.com...[color=blue]
        > NoMail <NoMail@nomail. com> wrote in message[/color]
        news:<c5loog$e0 i1@news.rd.fran cetelecom.fr>.. .[color=blue][color=green]
        > > Omavlana a ecrit, Le 15/04/2004 09:46 :
        > >[color=darkred]
        > > > 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[/color]
        > >
        > >
        > > select Iif(Isnull(col1 )),0,col1), Iif(col2,Isnull (col2)),0,col2) from tab1;[/color]
        >
        >
        > or you can use the NZ function built into Access.
        >
        > SELECT nz([col1],0), nz([col2],0)FROM tab1;[/color]


        Comment

        Working...