Q&A for Drupal developers and administrators
DECLARE @str VARCHAR(50) SET @str = '/one/two/three/whatever/testing' SELECT SUBSTRING(@str, 0, CHARINDEX('/', @str, CHARINDEX('/', @str, CHARINDEX('/', @str, CHARINDEX('/', @str, 0) + 1) + 1) + 1))