I want to select a part of a string in two query
- "Server \ Windows \ Access Database"
- "Access Database \ Server \ Windows"
i want to select whatever is there after the first '\' in one query and in second query i want to select the text after second '\'
between the '\' the length of the text keeps changing.
I have tried:
SELECT Somecolumn=Substring(column1, 0, Charindex('\', column1, 1))
FROM dbo.sometable
The result:
SOMECOLUMN
Server
Access Database
Sql-Fiddle: http://sqlfiddle.com/#!3/f0458/1