1. What is a Linked Server?
- When we want to query on remote database server along with the local database server then we can add the remote SQL server to local SQL server in a same group using the concept called Linked Server.
- We can query on both servers using T-SQL.
- We can use stored Procedure sp_addlinkedserver, sp_addlinkedsrvlogin to add new Linked Server.
- By using Linked Server we can SQL statement in clean and easy way to retrieve, join and combine remote data with local data.
2. Describe how to use Linked Server.
MS SQL Server supports the connection to different OLE DB on an ad hoc basis. This persistent connection is referred as Linked Server.
The following are the steps to use Linked Server for any OLE DB. I refer this to use an MS-Excel workbook.
Open SQL Server Management Studio in SQL Server 2005
Expand Server Objects in Object Explorer.
Right-click on Linked Servers. Click on New Linked Server.
Select General page in the left pane and
i. Type any name for the linked server in the first text box
ii. Select the Other Data Source option.
iii. Click on Microsoft Jet 4.0 OLE DB Provider from the Provider list.
iv. Type the Excel as the name of the OLE DB data source.
v. Type the full path and file name of the Excel file in Data Source box.
vi. Type the Excel version no. (7.0, 8.0 etc) in the Provider String. Use Excel 8.0 for Excel 2000, Excel 2002 or Excel 97.
vii. To create a linked server click on OK.
No comments:
Post a Comment