Linked Server Creation
Open the Enterprise Manager in SQL Server. Go to Security->Linked Servers.
Right click and select New Linked Server. Select SQL Server radio button.
Give network name of SQL Server in Linked Server textbox. Select the Security tab. Select ‘Be made using this security context’.
Give sa in Remote Login textbox and keep password blank. Note:- This should be the login and password to connect to remote server.
Click OK. It will create the Linked Server for remote server.
Accessing data from Linked Server
First register the Linked Server. Simple wizard would help you to register the server.
SELECT *
FROM
LNKSERVER.Food.dbo.Food_Leisure
Here LNKSERVER is the Linked Server name, Food is the database name, dbo is the default user and Food_Leisure is the table name.
Accessing data from Linked Server through Stored Procedure
SELECT *
FROM
LNKSERVER.Food.dbo.Food_Leisure
FROM
LNKSERVER.Food.dbo.Food_Leisure
SET ANSI_NULLS OFF
No comments:
Post a Comment