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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need left of the star in a field

Status
Not open for further replies.

lauriebizz

Technical User
Sep 19, 2005
53
US
Hi, I though maybe someone could answer my question... typically I use Crystal 9, but have a SQL question...

the field claimant_name on claim table has last-name*first (example: COOPER*LAV). Do you know how to get the last name only out of that cell (the part to the left of the *)?

Thanks for any help!
Laurie
 
You will want to use the SUBSTRING and CHARINDEX commands.
Code:
SELECT SUBSTRING(NameField, 0, CHARINDEX('*', NameField)-1)
FROM Table

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top