February 10, 2010 at 11:22 pm
Hi All,
How you define and use of OPENROWSET and OPENQUERY in simple words as I m not getting clear it from BOL.
Regards,
Shivrudra W
February 11, 2010 at 9:13 am
Let's see what BOL states:
OPENQUERY Executes the specified pass-through query on the specified linked server.
This means that OPENQUERY can be used to execute a query on a remote linked server and get back the results.
A simple example woulf be:
SELECT * FROM OPENQUERY(OracleServer, 'SELECT * FROM SomeTable')
OPENROWSET doesn't need to have a linked server set up, because all connection properties will be included in the parameters. In fact, it is also know as "ad-hoc" queries.
From BOL:
Includes all connection information that is required to access remote data from an OLE DB data source. This method is an alternative to accessing tables in a linked server and is a one-time, ad hoc method of connecting and accessing remote data by using OLE DB.
Simple example:
SELECT * FROM OPENROWSET('OraOLEDB.Oracle','OracleServer';'user';'pwd','SELECT * FROM SomeTable')
Hope this helps
Gianluca
-- Gianluca Sartori
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply