Problem
There is no SQL Function to get the last index of a string.
Ansatz – Approach
The first two lines only declare a variable myString with content SER-SOP-12 to Test the combined SQL Functions.
The SELECT-Clause returns the lastIndex of (can be used in standard MS SQL Statements)
Lösung – Solution
Just copy it to the MS SQL Server Management Studio in a query window to test and press F5:
DECLARE @myString AS varchar(255) SET @myString ='SER-SOP-12' SELECT LEN(@myString )-CHARINDEX('-', REVERSE(@myString ))