I have got field containing comma separated values. I need to extract the last element in the list. I have tried with this:
select list_field, LTRIM(RTRIM(rig
Find the last ,
by reversing the string and looking for the first occurrence, then read that many characters from the right of the string;
rtrim(right(list_field, charindex(',', reverse(list_field)) - 1))
(Use reverse(list_field) + ','
if there is the possibility of no delimiters in the field & you want the single value)