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.
Rahul writes "Hi FriendsI have table with 2 cols the data is as followsName GenderA MB FC MD MD F.....In a single query I want to change the values of M to F and F to MPlease helpThanksRahul"
nathans
Aged Yak Warrior
938 Posts
Posted - 2005-08-01 : 15:08:52
Homework?? Look up case in BOL...
declare @deez table ([name] char(1), gender char(1))insert into @deez select 'A','M' union all select 'B','F' union all select 'C','M' union all select 'D','M' union all select 'E','F'select * from @deezupdate @deezset gender = case gender when 'M' then 'F' else 'M' endselect * from @deez