Microsoft SQL Server PARSENAME


Example

Declare @ObjectName nVarChar(1000) 
Set @ObjectName = 'HeadOfficeSQL1.Northwind.dbo.Authors' 

SELECT
 PARSENAME(@ObjectName, 4) as Server
,PARSENAME(@ObjectName, 3) as DB
,PARSENAME(@ObjectName, 2) as Owner
,PARSENAME(@ObjectName, 1) as Object 

Returns:

ServerDB
HeadofficeSQL1Northwind
OwnerObject
dboAuthors