Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Enterprise
Expertise: Advanced
Feb 1, 2001

Create a Linked Server in SQL Server


You can establish a link to the remote SQL Server using this code:
 
Sp_addlinkedserver
Syntax :
SP_addlinkedserver
[@Server]='server'[,[Srvproduct=]'product_name'[,[@provider=]'provider_nam
e'][,[@datascr=]'data_source'][,[location=]'location'
[,[@provstr=]'Provider_string'[,[@catalog=]'catalog']

server:         Name of the linked server to create
product_name:   Product name of te OLE DB data source
Provider_name:  The unique,friendly name for the OLE DB provider
corresponding to this data source
data_source:   Name of data source
location:      location of database
provider_string: The OLE DB provider string
catalog:   The Catalog name (In SQL Server is database name)
example :
Connecting to remote SQL Server

If you are connecting to a server that is running SQL Server 7.0, the only arguments that must be provided are the 'provider_name' and 'server' arguments. Other arguments are used automatically.
 
EXEC sp_addlinkedserver 'Accountingserver','SQL server'

'Accountingserver' is the server name and 'SQL server' is the provider name.
Mahyar Ghasemali
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date