How to convert empty spaces into null values, using SQL Server?

前端 未结 7 1946
無奈伤痛
無奈伤痛 2020-12-14 05:56

I have a table and the columns on this table contains empty spaces for some records. Now I need to move the data to another table and replace the empty spaces with a N

7条回答
  •  清歌不尽
    2020-12-14 06:34

    here's a regex one for ya.

    update table
    set col1=null
    where col1 not like '%[a-z,0-9]%'
    

    essentially finds any columns that dont have letters or numbers in them and sets it to null. might have to update if you have columns with just special characters.

提交回复
热议问题