Executes the specified pass-through query on the given linked server. The 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 for an INSERT, UPDATE, or DELETE statement. However, this depends on the functionality of the OLE DB access interface. Although the query may return more than one result set, OPENQUERY returns only the first one.
1. Select method:
SELECT * FROM OPENQUERY (linkservername, ' SELECT * FROM table_name ')
2. Update method:
Update OpenQuery (linkservername, ' SELECT * FROM table_name where xxx=mmmm ')
Set xxx= ' nnnnn '
3. Delete method
Delete OpenQuery (linkservername, ' SELECT * FROM table_name where xxx=mmmm ')
The above requirements for registration:
The string processing in the WHERE clause should be similar to the use of two single quotes instead of double quotes, or single quotes (by default, single quotes)
OpenQuery usage and where you need to be aware of it