DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Greg has posted 3 posts at DZone. View Full User Profile

Query And Join Tables Across Server Instances.

12.31.2006
| 13216 views |
  • submit to reddit
        Use the following to query or join tables on remote servers.  The query must be executed on a system running SQL Server, but the remote system can be pretty much anything an ODBC driver exists for:
select * from OpenDataSource(’SQLOLEDB‘,’Data Source=server.asdf.com;User ID=yourusername;Password=yourpassword‘).somedatabase.dbo.sometable;