Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Issue With Stored procedure

Author  Topic 

rammohan
Posting Yak Master

212 Posts

Posted - 2009-12-28 : 04:18:19
i have a scenario:

i have two database servers say dbserver1,dbserver2.
database in dbserver1 is db1,
database in dbserver2 is db2

i need to write a sp in dbserver1.db1 database which need to access a table say tb2 in db2 of dbserver through select command.

how can i write it?

One can never consent to creep,when one feels an impulse to soar
RAMMOHAN

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-12-28 : 04:20:25
Read about sp_AddLinkedServer in sql server help file

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

rajdaksha
Aged Yak Warrior

595 Posts

Posted - 2009-12-28 : 04:23:43
Hi

Use linked server the Server to execute commands against OLE DB data sources on remote servers.
The ability to issue distributed queries, updates, commands, and transactions across the servers.


[url]http://msdn.microsoft.com/en-us/library/aa560998(BTS.20).aspx[/url]
-------------------------
R...
Go to Top of Page

rammohan
Posting Yak Master

212 Posts

Posted - 2009-12-28 : 04:26:59
hi,

both are sqlserver2000 versions only. in that case also i need use linked server?

One can never consent to creep,when one feels an impulse to soar
RAMMOHAN

Go to Top of Page

rajdaksha
Aged Yak Warrior

595 Posts

Posted - 2009-12-28 : 04:38:43
Hi

Yes you can

Refer
http://msdn.microsoft.com/en-us/library/aa936675(SQL.80).aspx


-------------------------
R...
Go to Top of Page

ajitgadge
Starting Member

12 Posts

Posted - 2009-12-28 : 08:26:48
If you do not want to use Link server then you can also use Openrowset or Openquery instead of link server.
Go to Top of Page
   

- Advertisement -