I have a varchar variable been defined like this.
declare @IDs varchar(50)
set @IDs ='111,123,567,'
Now I need to extract the last value in the list always 567.
The values in @IDs can be like this also
set @IDs ='56,'
In this case we need extract only the value 56.
How can we do it?
i think you will find this user defined function to split the string helpful:
http://www.codeproject.com/Articles/7938/SQL-User-Defined-Function-to-Parse-a-Delimited-Str