Re: Maximum UNION statements in a query



Hi

Shoot yourself.

SQL Server 7.0, 2000 and 2005 limits are as follows:
Tables per SELECT statement: 256

So, not only will your queries perform badly, but you walk into a 256 table
limit. No matter if you have views etc, but 256 base tables is all you get.

With correct design, you could have all the data in one table and access the
data through views to enforce security.

Regards
--------------------------------
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland

IM: mike@xxxxxxxxxxxx

MVP Program: http://www.microsoft.com/mvp

Blog: http://www.msmvps.com/epprecht/

"laurenq uantrell" <laurenquantrell@xxxxxxxxxxx> wrote in message
news:1134803057.417044.220780@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Wondering if there is a physical or realistic limitation to the number
> of UNION statements I can create in a query? I have a client with
> approx 250 tables - the data needs to be kept in seperate tables, but I
> need to be filtering them to create single results sets. Each table
> holds between 35,000 - 150,000 rows. Should I shoot myself now?
>
> lq
>


.



Relevant Pages

  • Re: question on the primary key
    ... >> Technically, it doesn't matter. ... >> Tibor Karaszi, SQL Server MVP ... >>> primary keys)? ...
    (microsoft.public.sqlserver.server)
  • Re: How to improve SQL Server operations
    ... You might try running your problem queries through the Index Tuning Wizard. ... >> Dan Guzman ... >> SQL Server MVP ...
    (microsoft.public.sqlserver.programming)
  • Re: reindex or update stat
    ... change in the way the queries are run. ... Andrew J. Kelly ... SQL Server MVP ... > I have a database that will have couple thousands row inserted normally, ...
    (microsoft.public.sqlserver.server)
  • Re: Identity field question
    ... It does not matter if I get gaps. ... > Tibor Karaszi, SQL Server MVP ... >>I have an identity field on a table automatically updated by SQL. ...
    (microsoft.public.sqlserver.programming)
  • Re: TSQL Question. URGENT Help. Exists and Not Exists Question
    ... SQL Server MVP ... > Funny but true. ... As a matter of fact, no rules seem to apply to the real ... check out Jeff Schmidt's book ( ...
    (microsoft.public.sqlserver.programming)