Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
I need a little help with some data scrubbing. I have a column that I need updated with information in another column but I need the source column set to ''.UPDATE table SET col001 = col002 where col001 = 'something''something' needs to be over written with col002 and after that is complete col002 needs to be set to blank. Any help would be appreciated. Thanks.
TG
Master Smack Fu Yak Hacker
6065 Posts
Posted - 2005-01-28 : 10:55:29
This seems to work:
create table #temp (col1 int null, col2 int null)insert #temp (col1) values (1)insert #temp (col1) values (2)insert #temp (col1) values (3)SElect * from #tempupdate #temp set col2 = col1 ,col1 = null where col1 = 2SElect * from #temp