Consider you have table Say TblEmployee with a column say EmployeeName which contain Records as A,B,A,A,B,C,B,C,Ayour task is to write a query which will change the EmployeeName A to B and B to A.
Sukesh Marla
CREATE table #TbleEmployee (EmployeeName varchar(10))insert into #TbleEmployee(EmployeeName)VALUES('A'),('B'),('A'),('A'),('B'),('C'),('B'),('C'),('A')update #TbleEmployee SETEmployeeName=(CASE EmployeeName WHEN 'A' THEN 'B' WHEN 'B' THEN 'A' ELSE EmployeeName END)
You all have entered correct