SQL Server 2008 LAN cross-Servers T-SQL operations (i)

Source: Internet
Author: User

-- To view the current link situation: Select *  from sys.servers; --

Reference:https://msdn.microsoft.com/zh-cn/library/ms190479.aspx
EXECsp_addlinkedserver@server=N'CEM1',@srvproduct=N"',@provider=N'SQLOLEDB',@datasrc=N'192.168.35.6'--Add user login link, parameters: The server alias being accessed, whether to connect by impersonating a local login or explicitly submitting a login name and password, whether to log on locally, login user name, login password

Reference:Https://msdn.microsoft.com/zh-cn/library/ms189811.aspx
 EXECsp_addlinkedsrvlogin'CEM1','false',NULL,'SA','Server' 

--use Sp_helpserver to display the available linked servers
Execsp_helpserver

--Delete a link that already exists, parameter: Server alias, SQL Server login on the local server. If you want to delete a link, first remove the login map

Reference:https://msdn.microsoft.com/zh-cn/library/ms186218 (v=sql.120). aspx
Exec ' CEM1 ',NULL
Exec ' CEM1 '

-- application: Link alias. database name. Table name
SELECT * from CEM1. [Test2.1]

SQL Server 2008 LAN cross-Servers T-SQL operations (i)

Related Article

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.