I am using sql server. 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 NULL value. I tried to use
REPLACE(ltrim(rtrim(col1)),' ',NULL)
but it doesn't work. Because it will convert all the value of col1 to NULL. I just need to convert only those values that have empty spaces to NULL.
Thank you in advance for your help.