Transfer SQL Server database to create a linked server to access SQL Server database to another

 

Following the articles to create a linked server in sql server database access oracle: http://www.cnblogs.com/527289276qq/p/4770379.html

This article describes how to create a linked server to access sql server database in sql server.

 

method:

 Open SSMS, new program, execute the following sql statement blocks:

Copy the code
EXEC  sp_addlinkedserver
@ Server = 'DBMES', - the link server alias
@srvproduct='',
@provider='SQLOLEDB',
@ Datasrc = '192.168.5.139' - want to access the database server resides ip
GO
EXEC sp_addlinkedsrvlogin
'DBMES', - the link server alias
'false', 
 NULL,
'Sa', - users want to access the database              
'Xxxx' - database, the user's password to be accessed
GO
Copy the code

 

Among them, "linked server alias" taken lightly, simply modify the "ip server's database to be accessed resides"

"User" and "secret" code (you want to access sql sever database sa account and password I use).

After successful execution, the refresh link on the left SSMS server, the new server links will appear, as shown below:

Finally, we test, table, sql statement on the database query is accessed similar to the following:

SELECT * FROM [DBMES]. [Database name]. [Dbo]. [Table Name]

Screenshot operating results:

Guess you like

Origin www.cnblogs.com/bit5566/p/12364893.html