1

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**
2
  • UPDATE myTable SET column1 = 'N/A' WHERE column1 IS NULL Commented Sep 5, 2013 at 14:27
  • Why do you want to do this? It is adding to you DB size without adding any value to the data stored there. Commented Sep 5, 2013 at 14:49

1 Answer 1

3

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')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.