Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I would like you to kindly answer me the query for the below table.

For eg i have a table in the below design

eid Gender
1 M
2 F
3 M
4 F

In a single sql query i want to replace the string M as 'MALE' and F as 'FEMALE'in gender column.
Posted
Comments
[no name] 8-May-14 3:09am    
try this it might help you
UPDATE tblGender SET Gender = CASE WHEN Gendor ='M' THEN 'Male' ELSE 'Female' END
Member 10803163 8-May-14 3:31am    
THANKS A LOT

You can use this query,

SQL
update yourtablename
set gender=case WHEN gender= 'm' THEN 'male'
  WHEN val = 'f' THEN 'female'  end
 
Share this answer
 
v2
Comments
Maciej Los 8-May-14 3:15am    
And the second part (female)?
Member 10803163 8-May-14 3:32am    
THANK U
Maciej Los 8-May-14 3:58am    
+5!
UPDATE tblGender SET Gender = CASE WHEN Gendor ='M' THEN 'Male' ELSE 'Female' END
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900