Bineesh  Viswanath

Bineesh Viswanath

  • NA
  • 1k
  • 780.5k

SQL Server Query to Interchage row value

Oct 8 2013 5:33 AM
Sir, I need your help in the following topic.

I have a table named tbl_Person. It has columns: id(numeric(18,0), firstName(varchar(20), Gender(int).

please find the attached file with this for screenshot.

in that, I gave value 1 to Male and 2 to Female. Then all row with gender male show 1 and female with 2.

Now I want to change the Female corresponding number from 2 to 1 and male from 1 to 2.

Please give me the query to interchange the value of rows.

Attachment: swap.zip

Answers (2)