Wrox Programmer Forums
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 28th, 2006, 08:40 PM
Authorized User
Join Date: Aug 2004
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default Query Between Servers

Hey Guys,

In SQL Server, I am trying to figure out how to write a query between two different tables on two different databases, with the databases located on two different servers. For instance, I want to join table a in database x located on server 1 with table b located in database y on server 2. Any idea how that query would look in Enterprise Manager, and/or how would that query work in a vb.net application.


Old February 28th, 2006, 10:10 PM
SQLScott's Avatar
Wrox Author
Join Date: Dec 2004
Posts: 338
Thanks: 0
Thanked 2 Times in 2 Posts

In SQL Server 2005 you can select across databases (not 2000), not sure about across servers. I will try across servers tomorrow at work where I have two SQL 2005 boxes.


Old March 1st, 2006, 05:47 AM
Authorized User
Join Date: Jun 2003
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts

There is no problem selecting across databases in 2000, you just prefix the tablename with database-name and owner-name like this:

Select * from [databasename].[Ownername].[tablename]

If you need to select from another physical server, you could set up a linked server and then do the select like this:

Select * from [LinkedServerName].[databasename].[Ownername].[tablename]


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linked Servers rklio SQL Server 2005 0 February 5th, 2007 12:00 PM
Link Servers Help aven SQL Server 2000 0 January 14th, 2006 03:52 AM
Connection between 2 Servers venterjo Classic ASP Databases 1 November 10th, 2005 05:57 PM
linked servers bukky Classic ASP Databases 1 March 6th, 2004 06:31 AM
Linux Servers asaleh Linux 9 July 19th, 2003 06:09 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.