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

Finding a character in a string

Status
Not open for further replies.

davetek

Programmer
Oct 30, 2002
42
IE
Hi,
I have a string "ABC;DC" and I only want to see ABC. However the number of characters prefixing the ";" will change. Can someone tell me of a way do this using a view?

Many Thanks.
 
Code:
SELECT LEFT(col, CHARINDEX(';', col) - 1)
FROM table

If there are values that don't contain ';' then you will get an error.

--James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top