Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2003
    Location
    india, delhi
    Posts
    18

    Question Unanswered: replacing all nulls by 0 through table

    I'm working on sql server and I want to replace all null values by 0 through out the table...

    please tell me the query..


    rgds
    Sudeesh
    www.GaloisTech.com

  2. #2
    Join Date
    Oct 2003
    Location
    Republic of Srpska, Bosnia and Herzegovina
    Posts
    35
    update your_table set your_field=0 where your_field is null;

  3. #3
    Join Date
    Oct 2003
    Location
    india, delhi
    Posts
    18

    Re: replacing all nulls by 0 through table

    Originally posted by sudeesh
    I'm working on sql server and I want to replace all null values by 0 through out the table...

    please tell me the query..


    rgds

    I know this simple query..
    but query should be so that if we dont know how many column are there, then all nulls r replaced by 0 through out table by single query only..
    Sudeesh
    www.GaloisTech.com

  4. #4
    Join Date
    Oct 2003
    Posts
    87

    Re: replacing all nulls by 0 through table

    Originally posted by sudeesh
    I know this simple query..
    but query should be so that if we dont know how many column are there, then all nulls r replaced by 0 through out table by single query only..
    Can't think of a way to do this with just SQL. A PL/SQL script would be needed. First find all tables in a Schema via DBA_TABLES, then all columns in a table via DBA_TAB_COLUMNS, then test each column for NULL setting it to 0. You could test all the columns in all tables in an Oracle instance by first selecting all tables from DBA_TABLES where type = table.
    Oracle - DB2 - MS Access -

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •