Take the 2-minute tour ×  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.  share|improve this
question Why did you tag this question with [oracle]? –  APC Sep
13 '10 at 15:26 because oracle and sql server queries are
similar. So, if a query works for oracle that can be implemented
on sql server too. –  niceApp Sep 13 '10 at 15:44 @niceApp,
that's not necessarily true about ORACLE and Sql Server. They
are similar yes, but not the same. Your question would in fact,
be meaningless for Oracle, because Oracle treats empty string as
NULL, so you would just need to trim it and you'd be done. – 
eidylon Sep 16 at 16:35  7 Answers 7