Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Update and get first character of string

Author  Topic 

djamit
Starting Member

17 Posts

Posted - 2014-12-23 : 07:56:20
Hi

I have a column in SQL showing Patient Sex (Female/Male)
How Can I update the Column so that I can see only the first character of the string Female and Male( F and M)?

ahmeds08
Aged Yak Warrior

737 Posts

Posted - 2014-12-23 : 08:06:40
update table set sex=(case when gender='Male' then 'M' else 'F' end)

Javeed Ahmed
https://www.linkedin.com/pub/javeed-ahmed/25/5b/95
Go to Top of Page

Ifor
Aged Yak Warrior

700 Posts

Posted - 2014-12-23 : 08:25:35
If you have any influence on the DB design, you should be using standard ISO codes:
http://en.wikipedia.org/wiki/ISO/IEC_5218
Go to Top of Page
   

- Advertisement -