SqlServer cross-server DML

Source: Internet
Author: User
There are three stored procedures: sp_addmediaserver Add Server link sp_javasservers query server link sp_dropserver Delete server link example: ----------------------------------------- first create connection server execsp_add1_serverinstance1, MSDASQL, NULL, N

There are three stored procedures: sp_addmediaserver Add Server link sp_javasservers query server link sp_dropserver Delete server link example: Login -- first create connection server EXEC sp_addmediaserver 'instance1', '', 'msdasql ', NULL, N

A total of three stored procedures

Sp_addmediaserver Add Server Link

Sp_linkedservers
Sp_dropserver Delete server Link

Example:

-------------------------------------

-- Create a linked server first
EXEC sp_addmediaserver
'Instance1 ',
'',
'Msdasql ',
NULL,
NULL,
'Driver = {SQL Server}; SERVER = 192.168.1.100; UID = sa; PWD = 123 ;'
GO

-- View linked servers
EXEC sp_incluservers

-- Delete a linked server
EXEC sp_dropserver 'instance1'

-- Start query Test
Select * from instance1.db1. dbo. table1
Select * from alias. Database Name. dbo. Table Name

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.