Update all SQL NULL values in multiple columns using Column level WHERE clause?

前端 未结 4 1874
花落未央
花落未央 2021-01-02 18:31

We have a database with a bunch of wide tables (40-80 columns each) and just found a bug that introduced NULL values into about 500 of the records. The NULL values can appea

4条回答
  •  难免孤独
    2021-01-02 19:22

    Since you have to do this all over the place i wrote some javascript to help you build the sql. cut and paste this into your browsers address bar to get your sql.

    javascript:sql='update your table set ';x=0;while(x <= 40){sql += 'answer_'+x+ ' = coalesce(answer_'+x+',99),\n';x++;};alert(sql);
    

提交回复
热议问题