To get string after last index of a string use following line of code:
DECLARE @vc_string varchar(100)
SET @vc_string = 'a/b/c/d'
SELECT REVERSE(SUBSTRING(REVERSE(@vc_string), 0, CHARINDEX('/', REVERSE(@vc_string)))) AS vc_value
Above query will give output d
DECLARE @vc_string varchar(100)
SET @vc_string = 'a/b/c/d'
SELECT REVERSE(SUBSTRING(REVERSE(@vc_string), 0, CHARINDEX('/', REVERSE(@vc_string)))) AS vc_value
Above query will give output d
No comments:
Post a Comment