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 same column with different values

Author  Topic 

rahulwalls
Starting Member

1 Post

Posted - 2005-07-19 : 03:49:47
Hi,

I have table with 2 cols

Name Gender
A M
B M
C F
D M
E F
F F
......

I need to write a single query which will change the value from M TO F and F TO M of the Gender Column

Is it possible pls help

Thanks
Rahul

AndyB13
Aged Yak Warrior

583 Posts

Posted - 2005-07-19 : 03:58:52
Try

UPDATE YourTable
SET Gender = CASE WHEN Gender = 'M' THEN 'F' ELSE 'M' END


Andy

Beauty is in the eyes of the beerholder
Go to Top of Page
   

- Advertisement -