Sunday, May 6, 2012

Add Linked server using Command


A linked server configuration allows Microsoft® SQL Server™ to execute commands against OLE DB data sources on different servers. Linked servers offer these advantages:

  • Remote server access.
  • The ability to issue distributed queries, updates, commands, and transactions on heterogeneous data sources across the enterprise.
  • The ability to address diverse data sources similarly

sp_addlinkedserver
Creates a linked server. A linked server allows for access to distributed, heterogeneous queries against OLE DB data sources. After a linked server is created by using sp_addlinkedserver, distributed queries can be run against this server. If the linked server is defined as an instance of SQL Server, remote stored procedures can be executed.

Command:
EXEC sp_addlinkedserver @server= SERVER NAME

eg, your server name is myDBserver then 
EXEC sp_addlinkedserver @server = 'myDBserver'


sp_addlinkedsrvlogin
Creates or updates a mapping between a login on the local instance of SQL Server and a security account on a remote server.

Command:
EXEC sp_addlinkedsrvlogin  @rmtsrvname , 'TRUE' | 'FALSE' | NULL@locallogin@rmtuser
@rmtpassword 

eg,
EXEC sp_addlinkedsrvlogin 'myDBserver, 'false', NULL, 'sa', 'password'



8 comments:

Tekslate Trainings said...

For more tutorials and Queries on SQL, Check this site for in-depth SQL tutorials. Go here if you’re looking for tutorials on SQL .

Dwarakesh babu said...


Everyone should aware of this method mentioned here try to implement on practical also
PlSQL Online Trainings | PlSQL Training

Gopal Ainavalli said...

For more tutorials and Queries on SQL.Really thankful to you.


Weblogic Server 12cR2 Training

Peter Johnson said...

I Just Love to read Your Articles Because they are very easy to understand.Very Helpful Post And Explained Very Clearly About All the things.Very Helpful. Coming To Our Self We Provide Restaurant Equipment Parts Through Out US At Very Affordable Prices And Also We Offer Same Day Shipping In US.We Offer Only Genuine Products.Thanks For Posting.HAve a Nice Day!

seo said...

Really thanks for Posting, Updated Lot of unknown things to me, thanks for sharing the article,You have excelled the topic,Urgent Care Services Provided,Thank You for Sharing such an Informative and Useful Article.I Liked Your Writing Skills, Keep On going.

Lathika Honey said...

This Blog is very helpful and useful, came to know that I should be strong in my basics and this blog helps me to improve it, US Medical Residency in Chicago Services Provided by Us. Thanks For Posting.

Lathika Honey said...

Really Thanks For Posting Such a Useful and informative article. I would like to share this blog with my friends and Colleagues Tico Certification Training

svr online Training said...

Really A great informative blog post this blog provides only valuable information on Mulesoft Certification Training .Thanks For Sharing.