Monday, October 30, 2006
Linked Servers for data from another database
To select data from another server using MS SQL Server, you have to add it as a linked server, using the following stored procedures.
EXEC sp_addlinkedserver
@srvproduct= 'SQL Server'
,@server= 'srvname'
GO
EXEC sp_addlinkedsrvlogin @rmtsrvname = 'srvname'
, @useself = 'FALSE'
, @rmtuser = 'username'
, @rmtpassword = 'password'
GO
EXEC sp_addlinkedserver
@srvproduct= 'SQL Server'
,@server= 'srvname'
GO
EXEC sp_addlinkedsrvlogin @rmtsrvname = 'srvname'
, @useself = 'FALSE'
, @rmtuser = 'username'
, @rmtpassword = 'password'
GO