?
Solved

SQL Server Distributed Query  - what is the limit to how many different db's can be accessed in one query.

Posted on 2004-03-23
3
Medium Priority
?
253 Views
Last Modified: 2007-12-19
Using a distributed, also called heterogeneous query with SQL Server 2000, what is the maximum number of different databases that can be referenced in a single query?     SQL Server 2000 supports  2^16-1 - 32767 databases in a named instance.    Again, the question is,  in a distributed query, such as :

SELECT s1.income, s2.contractlength  from  server1.database.owner.table s1, server2.database32.owner.table s2

how many different db's can be referenced in one query, is it indeed up to 32767 ? Or, can you cross query across 5 instances, including 150,000 references to db+table in the query.

Granted, 150,000 databases may seem absurd, however, I am wondering what the maxium is, whether it is 16 different databases, or even 32,767.

Tim Miltz

0
Comment
Question by:tfmiltz
1 Comment
 
LVL 13

Accepted Solution

by:
danblake earned 1000 total points
ID: 10666269
It all becomes a lot lower:
Tables per SELECT statement 256...

So you can only reference a maximum of 256 different objects in a single query. (from linked servers/views/tables)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Suggested Courses

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question