Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old February 28th, 2006, 08:40 PM
Authorized User
 
Join Date: Aug 2004
Location: rogers, ar, USA.
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.

Thanks,


nikotromus
__________________
nikotromus
Reply With Quote
  #2 (permalink)  
Old February 28th, 2006, 10:10 PM
SQLScott's Avatar
Wrox Author
 
Join Date: Dec 2004
Location: Wellington, FL , USA.
Posts: 338
Thanks: 0
Thanked 2 Times in 2 Posts
Default

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.

Scott

Reply With Quote
  #3 (permalink)  
Old March 1st, 2006, 05:47 AM
Authorized User
 
Join Date: Jun 2003
Location: , , Norway.
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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]


Gert

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 07:09 AM



All times are GMT -4. The time now is 05:40 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.