T-SQL splitting column on a delimiter [duplicate]
T-SQL splitting column on a delimiter [duplicate] This question already has an answer here: I have a column with three groups data delimited by a forward slash, like so AB/1234/10 The column is always formatted the same in every row, with 2 characters, a slash, some number of characters, a slash, and then 2 more characters. I need to split this one column into three. So the above example becomes Column1 Column2 Column3 AB 1234 10 I'm not quite sure how to go about this. I've been using SELECT SUBSTRING but that isn't quite giving me what I need. SELECT SUBSTRING select SUBSTRING(MyColumn, 1, CHARINDEX('/', MyColumn, 1)-1) FROM MyTable Will return AB , and that's great. But I can't wrap my mind around how to grab the middle and the end sections. I thought that AB select SUBSTRING(MyColumn, 4, CHARINDEX('/', MyColumn, 4)) FROM MyTable Would work in grabbing the middle, but it returns 1234/10 1234/10 I hope my question is clear and I would appr...
