sql server 2008 - Is it possible to Update the table values which contains multiple criteria using single update statement -


table  id    desc 1     male 2     male 3     male 4     female 5     female 6     female 7     female 

i need update male female , female male using 1 update statement.kindly advice on this. in advance.

try

update table set desc  = case      when desc= 'male' 'female'     when desc  = 'female' 'male'     else desc           end  

out put follow

id    desc  1     female 2     female 3     female 4     male 5     male 6     male 7     male 

Popular posts from this blog

Php - Delimiter must not be alphanumeric or backslash -

c# - How to change the "Applies To" field under folder auditing options programatically (.NET) -

c++ - Ambiguity when using boost::assign::list_of to construct a std::vector -