I have a column SysTraNo
with some specific data like
HO/20-21/DRP/0001
215/21-22/AGP/0003
I want to trim that whole column and only take 20-21
or 21-22
of that data. How can I do this?
CodePudding user response:
Using the base string functions we can try:
SELECT val,
SUBSTRING(val,
CHARINDEX('/', val) 1,
CHARINDEX('/', val, CHARINDEX('/', val) 1) -
CHARINDEX('/', val) - 1) AS nums
FROM yourTable;