There is no default split function in SQL Server 2012 that I'm using.
I want to split the string (ex: /Folder1/Folder2/) by /.
- if string is
/Folder1/then output should beFolder1, - if string is
/Folder1/Folder2/then output should beFolder2, - if string is
/Folder1/Folder2/Folder3/then output should beFolder3.
SELECT REVERSE(SUBSTRING(SUBSTRING(REVERSE('/Folder1/Folder2/'),2,len(REVERSE('/Folder1/Folder2/'))),1,charIndex('/',SUBSTRING(REVERSE('/Folder1/Folder2/'),2,len(REVERSE('/Folder1/Folder2/'))))-1))