Database Script link Remote server

Source: Internet
Author: User

Do the project, do not know whether people have this problem, the local SQL is version 2005, but the server is version 2008, but need to link to view the data is not linked to. What about this time?

Well done! To do a few can be done in the sql2005 of the sql2008 data to be deleted and removed.

The first step: Log on locally on the sql2005. (Simple bar)

Step Two: Create a new query. (It's easy too)

Step three: In the new query, enter:

--Represents the creation of a remote linked object

EXEC sp_addlinkedserver

' Exam ',--remote server object name

‘‘,

' SQLOLEDB ',

' 192.168.1.*** '--the server IP that needs to be linked

sp_addlinkedsrvlogin

' Exam ',

' False ',

Null

' sa ',--database account

' Sasa '--Database password

After execution, assuming that you access the table Table1 of the database testdata on the target server, you can enter in a new local query: SELECT * from exam. TestData.dbo.Table1. You can query the data in the sql2008 database.

One problem to note here is that the method is not valid for stored procedures, and because the stored procedure calls a syntax constraint, the object name cannot be added to the stored procedure. No major cases have been identified for the time being. I hope you will forgive me.

Database Script link Remote server

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.