I need to extract “SRN=123” (the 123 is dynamic in length, SRN= is consistent) from a column. Data could be anything, no consistent format
456 lorem limpsump SRN=123 and some
more things 3.
I’m having trouble trying to use a charindex to find the ending point of SRN=123 to get the length, any help?
SUBSTRING(t.Instructions,
CharIndex('SRN=', t.Instructions) + 10,
(CHARINDEX('SRN=', t.Instructions )-(CharIndex('SRN=[^0-9.-]', t.Instructions) + 10)))
https://data.stackexchange.com/stackoverflow/q/104003/