Here is an eample using the PARSENAME function.DECLARE @x VARCHAR(255) = 'micheal jackson (emp2)';SELECT PARSENAME(REPLACE(@x,' ','.'),2) + ' '+ PARSENAME(REPLACE(@x,' ','.'),3) + ' ' + PARSENAME(REPLACE(@x,' ','.'),1)
Ideally, I wouldn't do it this way. I would find a string splitter function such as the one here http://www.sqlservercentral.com/articles/Tally+Table/72993/ and use that function like this:DECLARE @x VARCHAR(255) = 'micheal jackson (emp2)';SELECT LTRIM(( SELECT ' ' + Item FROM dbo.DelimitedSplit8K(@x,' ') ORDER BY CASE ItemNumber WHEN 2 THEN 1 WHEN 1 THEN 2 WHEN 3 THEN 3END FOR XML PATH('')))
The dbo.DelimitedSplit8K is in Figure 21 of that article.