column1
\\abc\tri\eds\rf1\edr\4ed
\\f.d\tri\ef\poe
\\ghi0j\tri\gf\rf\k\hg\ose
' ' '
i got some rows like that in a column
now i want to get the result set like
\\abc\tri\eds
\\f.d\tri\ef\
\\ghij\tri\gf
simply from first '\' to end of 4th '\'
column1
\\abc\tri\eds\rf1\edr\4ed
\\f.d\tri\ef\poe
\\ghi0j\tri\gf\rf\k\hg\ose
' ' '
i got some rows like that in a column
now i want to get the result set like
\\abc\tri\eds
\\f.d\tri\ef\
\\ghij\tri\gf
simply from first '\' to end of 4th '\'
In this week's episode of Horrible Code I Have Written For StackOverflow...
SELECT
SUBSTRING(column1, 1,
CHARINDEX('\', column1,
CHARINDEX('\', column1,
CHARINDEX('\', column1, 3) + 1) + 1))
FROM
TableName