Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Manupulating string in sql

Status
Not open for further replies.

indraT

IS-IT--Management
Jan 18, 2004
24
CA
Hi There,

I wanted to know if there is any way to manupulate this type of string in sql. I tried couple of function but its now giving me what i want. Pleae let me know if there is solution of this kind of problem.

In my database, [FirstName] is store as Joason P. or Mike H. or Jack ( Tom)

I need to extract this FirstName for first word before it hit the first space.
Like

Joason P. Like Joason
Mike H. LIke Mike
Jack (Tom) LIke Jack

If any one know about it Please let me know.

Thanks.
 
a select statement similiar to this might do it

Code:
select 
	case when charindex(' ', [firstname],1 )>0 then left(description, charindex(' ', [firstname],1 )) else [firstname] end
from MyTable

"I'm living so far beyond my income that we may almost be said to be living apart
 
Thank you very much. Its working now.

Indr.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top