Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

the usage of sp_addlinkedserver 1

Status
Not open for further replies.

diepblauw

MIS
Jun 3, 2003
15
CN
the situation is as following:

There are two servers in LAN: "server1" and "server2"

database "db1" is running on the SQL Server in "server1"
database "db2" is running on the SQL Server in "server2"

Table "t1" is in "db1"
Tbale "t2" is in "db2"

I wrote a trigger on "t1". When a row is inserted into "t1", the trigger is executed and a corresponding row is inserted into "t2"

How to write the code to create a linked server?

I have read the help information but I don't understand it well.
 
What part of what you have read don't you understand. There's plenty written about it. Do a google search.
-Karl
 
Is there a real need to run sp_addlinkedserver for your solution, or instead couldn't you just manually configure the linked server through Enterprise Manager and be done with it?

The linked server, once set up, will stay configured, regardless of which approach (manually through Ent Manager, or programmatically through sp_addlinkedserver) you take.

I have used the sp_ approach in a "data mining" solution in which we have dozens of identical databases installed throughout the enterprise and a web UI for dynamically adding the linked servers and mining remote data.

But, if I just had one linked server to setup and I knew the server ahead of time, I would just do it manually.

TR
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top