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

Manipulate a string using SQL

Status
Not open for further replies.

douggy

Technical User
Jan 18, 2001
78
0
0
GB
Hi there,

I have a string in a field which contains a document path.

example:

~/User/Documents/TGEACASE.PRT

I would like to extract just the file name. i.e everything after ~/User/Documents/

Any pointers on how to do this would be appreciated.

Regards
Mark
 
Try this ...

DECLARE @str varchar(100)
SET @str = '~/User/Documents/TGEACASE.PRT'
SELECT SUBSTRING( @str, LEN(@str) - CHARINDEX('/', REVERSE(@str)) + 2 , LEN(@str) )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top