Adding a linked server
By Mike Gledhill
You can add a Linked Server directly from within SQL Server Management Studio..
..or using a simple command. The following command creates a linked to a second SQL Server machine, then copies the records from it's [Orders] table into our current database:
EXEC sp_addlinkedserver
@server = 'Secondary_Server',
@srvproduct = '',
@provider = 'SQLNCLI', -- This is a connection to another SQL Server machine
@datasrc = 'MIKES_SERVER2'
GO
DELETE FROM [Orders]
GO
INSERT INTO [Orders]
SELECT * FROM [Secondary_Server].[Northwind].dbo.[Orders]
GO
If you have the Jet libraries installed, then you can also create a Linked Server connection to an Excel file:
Comments