OpenQuery usage

Executes the specified pass-through query on the specified linked server. This server is an OLE DB data source. OPENQUERY can be referenced in the FROM clause of a query as if it were a table name. OPENQUERY can also be referenced as the target table of an INSERT, UPDATE, or DELETE statement. This is subject to the capabilities of the OLE DB provider. Although the query may return multiple result sets, OPENQUERY returns only the first one.

Openquery 函数是不确定性的函数,就是说,对于相同的输入值,不保证每次返回的值都是相同的。

All rowset functions are nondeterministic. This means these functions do not always return the same results every time they are called, even with the same set of input values.

一,Syntax

OPENQUERY ( linked_server ,‘query‘ )

Any call to OPENDATASOURCE, OPENQUERY, or OPENROWSET in the FROM clause is evaluated separately and independently from any call to these functions used as the target of the update, even if identical arguments are supplied to the two calls. In particular, filter or join conditions applied on the result of one of those calls have no effect on the results of the other.

二,Examples

1,Executing an UPDATE pass-through query

UPDATE OPENQUERY (OracleSvr, ‘SELECT name FROM joe.titles WHERE id = 101‘)
SET name = ‘ADifferentName‘;

2,Executing an INSERT pass-through query

INSERT OPENQUERY (OracleSvr, ‘SELECT name FROM joe.titles‘)
VALUES (‘NewTitle‘);

3,Executing a DELETE pass-through query

DELETE OPENQUERY (OracleSvr, ‘SELECT name FROM joe.titles WHERE name = ‘‘NewTitle‘‘‘);

参考文档: MSDN OPENQUERY (Transact-SQL)

时间: 2024-10-27 12:24:59

OpenQuery usage的相关文章

sharepoint 2013 开启 Usage and Health Data Collection

Usage and Health Data Collection Monitoring the status of your farm's health is a critical aspect of SharePoint administration. This service application collects the various logging information stored in SharePoint and writes it to the logging databa

OPENQUERY

SELECT * FROM OPENQUERY(saql007,' SELECT  col1,col2,col3 FROM dbname.shemaname.tablename WHERE  (1=1) AND col1=''8888888'' ')

[转]Disk Space Usage and SQL Server Performance

Disk Space Usage and SQL Server Performance By Gregory A. Larsen When you think of SQL Server performance components, you think of the usage of CPU, memory, and the I/O it takes to process a query. However, there is another component you should consi

CSS减肥的工具–Firefox插件 CSS Usage

首先,我们需要安装Firefox(猛击此处下载),或者确定你已经安装的版本已经高于3.1; 第二步,安装前端开发人员最普及的开发工具 Firebug: 第三步,安装CSS Usage 0.3.4.1: 第四步,在浏览器中打开我们要优化的页面(本地的页面也可以),点击右下角的firebug小图标,打开firebug工具窗口,我们会看到在工具选项中我们有一个 CSS Usage工具的按钮. 首先我们来分析最上面的三个功能按钮的使用 Scan: 通过字面意思我们就能知道,这是一个扫描当前页面的工具,如

【DataStructure】Description and usage of queue

[Description] A queue is a collection that implements the first-in-first-out protocal. This means that the only accessiable object in the collection in the first one that was inserted. The most common example of a queue is a waiting line. [Interface]

【DataStructure】One of queue usage: Simulation System

Statements: This blog was written by me, but most of content  is quoted from book[Data Structure with Java Hubbard] [Description] This simulationillustrates objectoriented programming(OOP). Java objects are instantiated to represent all the interacti

[转]printk usage

原文地址:http://elinux.org/Debugging_by_printing#Usage If variable is of Type, use printk format specifier: --------------------------------------------------------- int %d or %x unsigned int %u or %x long %ld or %lx unsigned long %lu or %lx long long %l

Windows 8 Disk Usage Keep up 100%

Recently i find the windows8 Disk Usage always keep up 100%, It must be have some issue. Step1. Go into Open Task Manager Step2. Go to Details tab Step3. Right click the columns headers and click "Select Columns" Step4. From the "Select Col

Linux tar command usage

Linux tar command usage */--> Linux tar command usage Table of Contents 1. Create an archive: 2. Create a gzipped archive: 3. List the files in an archive 4. Add a file or directory to an existing archive The frequently used tar command are listed as