Vishwajeet Jha
Update "Male" into "Female" and "Female" into "Male" in Gender Column of a table in single line query.?
By Vishwajeet Jha in SQL Server on Apr 23 2015
  • Pergin Sheni
    Feb, 2020 11

    1. UPDATE table SET gender =
    2. (CASE WHEN gender ='male' THEN 'female' else 'male' END)

    • 0
  • MAHESH KUMAR
    Nov, 2019 2

    Update customer set Gender= case when Gender=’F’ then ‘M’ when Gender=’M’ then ‘F’ end where Gender in(‘F’,’M’)

    • 0
  • Umesh Maurya
    Jun, 2016 29

    update table_Name set Gender= Case when Gender='Male' then 'Female' else'Male' end

    • 0
  • Vishwajeet Jha
    Apr, 2015 23

    Update table_name set Gender= case when Gender='Female' then 'Male' when Gender='Male' then 'Female' end where Gender in('Female','Male')

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS