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

Extract Surname from Field

Status
Not open for further replies.

Kismet21

Technical User
May 21, 2008
1
AU
I am having an issue using SQL to separate the surname from the first name of the employee.

Shown in database as

Harmer; John Cain
Blogs; Joe

I am looking at how to write a query to extract the surname in these records


 
If all names are separated by a semi-colon, you can use CharIndex to find the position of the semi-colon and either Left or Substring to extract the surname.

In the future you might get a quicker response to this type of question in forum183 instead of this form, since this forum specifically deals with Reporting Services.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top