Nov 1, 2007 #1 douggy Technical User Jan 18, 2001 78 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
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
Nov 1, 2007 #2 PerlyGates Programmer Feb 1, 2006 20 IE Try this ... DECLARE @str varchar(100) SET @str = '~/User/Documents/TGEACASE.PRT' SELECT SUBSTRING( @str, LEN(@str) - CHARINDEX('/', REVERSE(@str)) + 2 , LEN(@str) ) Upvote 0 Downvote
Try this ... DECLARE @str varchar(100) SET @str = '~/User/Documents/TGEACASE.PRT' SELECT SUBSTRING( @str, LEN(@str) - CHARINDEX('/', REVERSE(@str)) + 2 , LEN(@str) )