/* APPROACH 1 */
update test set gender = (case when gender = 'M' then 'F' when gender = 'M' then 'F' end )/* APPROACH 2 */
declare @oldvalue varchar(10) = 'M'declare @newvalue varchar(10) = 'F'update test set gender = (case when gender = @oldvalue then @newvalue when gender = @newvalue then @oldvalue end )
No comments:
Post a Comment