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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Update Query

Author  Topic 

lokhande.shirish
Starting Member

4 Posts

Posted - 2007-01-17 : 06:47:59
Hi,

I am having a table with two column. NameID and Name.

Table having 4 rows. Name column have A,B,A,B

I want to write a update query so that so that A will interchange with B and vice-a-versa.

Thanks,

Shirish

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-17 : 06:55:22
UPDATE <YourTableNameHere>
SET Name = CASE WHEN Name = 'A' THEN 'B' ELSE 'A' END


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -