SELECT
R.Name0,
RIGHT(LEFT(R.Name0, 6), 3) AS ‘Site’,
RIGHT(LEFT(R.Name0, 9), 3) AS ‘Code’
FROM
dbo.v_R_System R
Order by
2,
R.Name0