Share Blog

Monday, January 11, 2016

How To Changev Male TO Female and Female To Male Using SQL SERVER

Create Table




 Insert Data in Table




Syntax

select * from Emp

Select id,name,
Case Gender
When 'M' Then 'F'
When 'F' Then 'M'
END

From Emp

Result







Update Male TO Female and Female To Male


UPDATE Emp SET gender =
CASE gender
WHEN 'F' THEN 'Male'
WHEN 'M' THEN 'Female'
ELSE
 gender END


Result






No comments:

Post a Comment