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.
Advertisement
Answer
Use nullif
select nullif(Column1, '') from Orders