OPENROWSET Example

A simple example for using OPENROWSET in SQL Server 2005 to access another SQL Server is goes as .....


SELECT * FROM OPENROWSET('SQLOLEDB',
'';;'',
'SELECT *
FROM .dbo.')

The SELECT within OPENROWSET can have where clause also. There is benefit associated also, sometimes you can access same data using Linked server strategy also; but in that case WHERE gets applied only when data is tranferred to destination. WHEREAS in case of OPENROWSET where gets applied on SOURCE itself.