Posted by Erland Sommarskog on 01/02/06 10:16
Sandy (a@a.com) writes:
> I want to write a query which reads data from a DataBase D1.table1 which
> is on some other machine and put it in DataBase D2.table2 The problem is
> 'How do i specify the IPAddress and the login information in a update
> Query'
> Can it be done using stored procedures..
You need to set up a linked server. To do this you use the system procedure
sp_addlinkedserver. To specify login information, you need to use
sp_addlinkedsrvlogin.
Once you have this working, you can refer to the remote table with four-
part notation, for instance SELECT ... FROM server.database.dbo.tbl
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
[Back to original message]
|