CHARINDEX
is your friend here. You're going to need to nest it within itself and run it twice because you want the second instance.
DECLARE @SearchString nvarchar(max)
SET @SearchString = '123400000111111~forname1~surname1~P50206.00011'
DECLARE @Delimiter nvarchar(1)
SET @Delimiter = '~'
/*
SELECT @SearchString AS [Your String]
--the string puked back
SELECT
RIGHT
(
@SearchString,
LEN(@SearchString) - charindex(@Delimiter, @SearchString)
) AS [The First Instance]
--first instance of @Delimiter
*/
SELECT
RIGHT
(
RIGHT
(
@SearchString,
LEN(@SearchString) - CHARINDEX(@Delimiter, @SearchString)
),
LEN
(
RIGHT(@SearchString, LEN(@SearchString) - CHARINDEX(@Delimiter, @SearchString))
) -
CHARINDEX
(
@Delimiter, RIGHT(@SearchString, LEN(@SearchString) - CHARINDEX(@Delimiter, @SearchString))
)
) AS [Your Awful Order By]
--what you're after
But for the love of all that is sacred in the world of databases as well as the sake of your own sanity, not to mention performance, do not store data like this!