I have a stored procedure that gives back a string that reads like //path1/path2/item.itm
, //path1/path3/item.itm
or //path4/path5/item.itm
what I would like to do is have it just return something like /path2/item.itm
I know that there is a replace in sql along the lines of REPLACE(String, ‘//path1’, ‘’)
but this wont work since the string is not consistent in all entries. I cant do this in the code because I may need to put the values back in.
If I were to do this in code (which I cant do) it would be something along the lines of
string = string.Remove(string.LastIndexOf('/'),
string.Length - string.LastIndexOf('/'));
but I have no idea how to do this in SQL or any idea if it can be done.