Click here to Skip to main content
15,885,365 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a column Name and his value is-----

Ram 88888888
Ravi 9999999999
jyotish 3333333333


I want the output is

Ram
Ravi
Jyotish
Posted
Comments
AmitGajjar 10-Jan-14 5:29am    
didnt get you. can you elaborate ?
AmitGajjar 10-Jan-14 5:30am    
do you want to get string before space or you want name without digits ?

Please have a look:
SQL
SELECT SUBSTRING(COLUMNNAME,0,CHARINDEX(' ',COLUMNNAME))  FROM TABLENAME
 
Share this answer
 
Comments
Tom Marvolo Riddle 10-Jan-14 5:56am    
A very good alternative 5!
Try this:
SELECT LEFT(columnname,PATINDEX('%[^a-z]%', columnname+'a')-1) FROM tablename
 
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