user2751035
user2751035

Reputation: 103

How To Remove Null Values in SQL from Multiple columns?

I have enormous amount of null values accross my SQL tables and it takes forever to remove them Column by Column. Is there a shortcut to replace all Null values with "N/A" Text.

    Column1 Column2 Column3 Column4
row 1   David   **Null**    15th Dec    $5666
row 2   **Null**    Director    10th JAN    $9500
row 3   John    Janator **Null**    $1000
row 4   Steve   Market  6th FEB **Null**

Upvotes: 1

Views: 3249

Answers (1)

Robert
Robert

Reputation: 25753

Maybe this way:

update tab
set Column1 = coalesce(Column1,'N/A'),
    Column2 = coalesce(Column2,'N/A'),  
    Column3 = coalesce(Column3,'N/A'), 
    Column4 = coalesce(Column4,'N/A')

Upvotes: 3

Related Questions