Blog Detail

17 Apr 2009
Tejas Shah
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' )
( '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.

About me


Tejas Shah

Microsoft Certified Professional Expert. I have 14+ years of experience in Design and Develop 100+ .Net applications using Asp.Net, C#, Asp.Net Core, VB.Net, SQL Server, MVC, AngularJS, JavaScript, Azure, HTML5 and CSS3.