Example specifying a specific name for the linked server:
/****** Object: LinkedServer [MYLINKEDSERVER] Script Date: 04/30/2012 09:24:54 ******/
EXEC master.dbo.sp_addlinkedserver @server = N'MYLINKEDSERVER'
, @srvproduct=N'KINDEL-G-W7'
, @provider=N'SQLNCLI'
, @datasrc=N'10.245.8.103'
/* For security reasons the linked server
remote logins password is changed with ########
@server - The name assigned to the linked server definition.
@srvproduct - Name or IP Address of server sql instance where the linked server is being added to.
@datasrc - Name or IP Address of remote server sql instance
Sample query:
SELECT * FROM MYLINKEDSERVER.<database name>.dbo.<table Name>
*/
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'MYLINKEDSERVER'
,@useself=N'False'
,@locallogin=NULL
,@rmtuser=N'sa'
,@rmtpassword='########'
GO
No comments:
Post a Comment