SQLTeam.com | Weblogs | Forums

Substring string from the end till specific character

Hi,

i need to get a string between two characters from the end of the string. E.G:
DECLARE @st varchar(250)
SET @st = 'http://www.somedomain.com/file/rch1231/' the final resoukt should be: rch1231

thanks from advanced,
S

select reverse(replace(substring(reverse(@st),1,charindex('/',reverse(@st),2)),'/',''))

Thanks a lot for the solution. working great.

S