How to replace empty spaces with NULL

sql, sql-server

Solution

Use `nullif`

select nullif(Column1, '') from Orders

Problem

I have a column in sql server 2012 which contain white spaces. I want to replace these empty spaces with NULL. I have written the following query but its not working. ``` SELECT replace(COLUMN1, '',NULL) FROM Orders; ``` How to achieve the above functionality. Thanks in advance.

Original source