Connect to Oracle through linked's slave servers to directly update relevant data

Source: Internet
Author: User
OPENQUERY executes the specified direct transfer query on the given linked server (an OLEDB data source. The OPENQUERY function can be referenced in the FROM clause of the query as if the table name was referenced. Based on the capabilities of the OLEDB provider, you can also reference the OPENQUERY function as the target table of the INSERT, UPDATE, or DELETE statement. Check

OPENQUERY executes the specified direct transfer query on the given linked server (an ole db data source. The OPENQUERY function can be referenced in the FROM clause of the query as if the table name was referenced. Based on the capabilities of the ole db provider, you can also reference the OPENQUERY function as the target table of the INSERT, UPDATE, or DELETE statement. Check

OPENQUERY

Execute the specified direct transfer query on the given linked server (an ole db data source. The OPENQUERY function can be referenced in the FROM clause of the query as if the table name was referenced. Based on the capabilities of the ole db provider, you can also reference the OPENQUERY function as the target table of the INSERT, UPDATE, or DELETE statement. Although a query may return multiple result sets, OPENQUERY returns only the first result set.

Syntax

OPENQUERY(Pai_server, 'Query')

Parameters

Pai_server

An identifier, indicating the name of the linked server.

'Query'

The query string executed on the linked server.

Note

OPENQUERY does not accept parameter variables.

Example

The following example uses the Microsoft ole db provider for Oracle to createOracleSvrThe linked server. Then, this example uses a direct transfer query for the linked server.

DescriptionThis example assumes that an Oracle database alias named ORCLDB has been created.

EXEC sp_addlinkedserver 'OracleSvr',    'Oracle 7.3',    'MSDAORA',    'ORCLDB'GOSELECT *FROM OPENQUERY(OracleSvr, 'SELECT name, id FROM joe.titles') GO

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.