Today, one developer asked me what is the difference between OpenQuery and OpenRowSet.
Let me share this thing with all of you.
Syntax for both the command:
OPENQUERY ( linked_server ,'query' )
OPENROWSET
( 'provider_name' , 'datasource' ; 'user_id' ; 'password'
, { [ catalog. ] [ schema. ] object | 'query' }
)
Difference is:
OpenQuery uses a predefined linked server,
While OpenRowSet has to specify all the connection options. So with OpenRowSet you can query to your remote SQL server from local.
Else it's the same.
Let me know if it helps you in any way.
Good one..
ReplyDeleteHello there.
ReplyDeleteIf I'm not wrong (but I might be) one processes the result at source, while the other processes it at the destination. Please correct me if I'm wrong.
I don't know about openquery, but openrowset processes the result at source.
ReplyDeleteopen rowset rocesses the result at source.
ReplyDelete