--returns a list of linked servers defined in the local server. EXECsys.sp_linkedservers/*creates or updates a mapping between logins on a local instance of SQL Server and security accounts in the remote server. When a user logs on to a local server and executes a distributed query to access a table on a linked server, the local server must log on to the linked server and access the table on behalf of that user. Use sp_addlinkedsrvlogin to specify the logon credentials that the local server uses to log on to the linked server*/EXECSys.sp_addlinkedsrvlogin@rmtsrvname = NULL,--sysname @useself = "',--varchar (8) @locallogin = NULL,--sysname @rmtuser = NULL,--sysname @rmtpassword = NULL --sysname /*create a linked server. A linked server allows users to distribute heterogeneous queries against OLE DB data sources. After you create a linked server by using sp_addlinkedserver, you can run distributed queries against that server. If the linked server is defined as an instance of SQL Server, you can execute a remote stored procedure. */ EXECSys.sp_addlinkedserver@server = NULL,--sysname @srvproduct =N"',--nvarchar (+) @provider =N"',--nvarchar (+) @datasrc =N"',--nvarchar (4000) @location =N"',--nvarchar (4000) @provstr =N"',--nvarchar (4000) @catalog = NULL --sysname /*test the connection to the linked server. If the test is unsuccessful, the procedure throws an exception that contains the reason for the failure. */ EXECSys.sp_testlinkedserver--The following example creates a linked server named SEATTLESales and then tests the connection. UseMaster;GOEXECsp_addlinkedserver'SEATTLESales'N'SQL Server';GOsp_testlinkedserver seattlesales;GO--------------------------------------