Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Does anybody knows how many unions ( max quantity ) can accept one sql query ?

4 posts in Windows NT Last posting was on 2000-04-25 20:32:55.0Z
Victoria Posted on 2000-04-24 16:30:50.0Z
From: "Victoria" <vfishman@too-smith.com>
Subject: Does anybody knows how many unions ( max quantity ) can accept one sql query ?
Date: Mon, 24 Apr 2000 12:30:50 -0400
Lines: 16
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.5600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.5600
Message-ID: <kOUv3wgr$GA.271@forums.sybase.com>
Newsgroups: sybase.public.sqlserver.nt
NNTP-Posting-Host: mail.tool-smith.com 207.198.251.30
Path: forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.sqlserver.nt:2267
Article PK: 1089698

Hello.

Does anybody knows how many unions ( max quantity ) can accept one sql query
?

SELECT name
from table
UNION
SELECT name
from table
UNION
SELECT name
from table
UNION ..........................


"Mark A. Parsons" <pegasys Posted on 2000-04-25 00:13:38.0Z
Message-ID: <3904E332.E8A03065@_internet.co.nz>
Date: Tue, 25 Apr 2000 12:13:38 +1200
From: "Mark A. Parsons" <pegasys@_internet.co.nz>
Organization: Pegasys Ltd
X-Mailer: Mozilla 4.72 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
Subject: Re: Does anybody knows how many unions ( max quantity ) can accept one sql query ?
References: <kOUv3wgr$GA.271@forums.sybase.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.sqlserver.nt
Lines: 14
NNTP-Posting-Host: p338.ipa1-n8-16.iconz.net.nz 210.48.25.82
Path: forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.sqlserver.nt:2264
Article PK: 1089696


Victoria wrote:
>
> Hello.
>
> Does anybody knows how many unions ( max quantity ) can accept one sql query
> ?
>
> SELECT name
> from table
> UNION
> SELECT name
> from table
> UNION
> SELECT name
> from table
> UNION ..........................

1) Why do you ask? Have you run into a problem? An error?

2) What happens if you actually run your desired query(s)?

--
Mark A. Parsons

Iron Horse, Inc. iron_horse@compuserve.com
Pegasys (200), Ltd pegasys@internet.co.nz


Victoria Posted on 2000-04-25 14:17:28.0Z
From: "Victoria" <vfishman@too-smith.com>
References: <kOUv3wgr$GA.271@forums.sybase.com> <3904E332.E8A03065@_internet.co.nz>
Subject: Re: Does anybody knows how many unions ( max quantity ) can accept one sql query ?
Date: Tue, 25 Apr 2000 10:17:28 -0400
Lines: 40
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.5600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.5600
Message-ID: <JoK1ALsr$GA.212@forums.sybase.com>
Newsgroups: sybase.public.sqlserver.nt
NNTP-Posting-Host: mail.tool-smith.com 207.198.251.30
Path: forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.sqlserver.nt:2262
Article PK: 1089694

I have to create dynamically SQL string and run. It can be 20 , 100 , 500
unions ( quantity unknown ).

I tried 25 and it created a desirable output. Does it mean that quantity of
unions is not limited?

"Mark A. Parsons" <pegasys@_internet.co.nz> wrote in message
news:3904E332.E8A03065@_internet.co.nz...
> Victoria wrote:
> >
> > Hello.
> >
> > Does anybody knows how many unions ( max quantity ) can accept one sql
query
> > ?
> >
> > SELECT name
> > from table
> > UNION
> > SELECT name
> > from table
> > UNION
> > SELECT name
> > from table
> > UNION ..........................
>
> 1) Why do you ask? Have you run into a problem? An error?
>
> 2) What happens if you actually run your desired query(s)?
>
> --
> Mark A. Parsons
>
> Iron Horse, Inc. iron_horse@compuserve.com
> Pegasys (200), Ltd pegasys@internet.co.nz


"Mark A. Parsons" <pegasys Posted on 2000-04-25 20:32:55.0Z
Message-ID: <390600F7.A3C21B82@_internet.co.nz>
Date: Wed, 26 Apr 2000 08:32:55 +1200
From: "Mark A. Parsons" <pegasys@_internet.co.nz>
Organization: Pegasys Ltd
X-Mailer: Mozilla 4.72 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
Subject: Re: Does anybody knows how many unions ( max quantity ) can accept one sql query ?
References: <kOUv3wgr$GA.271@forums.sybase.com> <3904E332.E8A03065@_internet.co.nz> <JoK1ALsr$GA.212@forums.sybase.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.sqlserver.nt
Lines: 23
NNTP-Posting-Host: p344.ipa1-n8-16.iconz.net.nz 210.48.25.88
Path: forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.sqlserver.nt:2258
Article PK: 1089689


> I tried 25 and it created a desirable output. Does it mean that quantity of
> unions is not limited?

As I said before ...

> > 2) What happens if you actually run your desired query(s)?

If you want to do 200 union's ... try it.

Since you're using 'UNION' and not 'UNION ALL' there's a chance that you
could run out of space in tempdb if you pull back a result set that's
larger than can fit in tempdb. ('UNION' requires that the entire result
set be sorted before returning the results; 'UNION ALL' says to forget
the sorting and return the result set in the order in which the rows are
selected.)

If you run into problems ... you could call Sybase TS and have them
research this issue further ... or ... you could break the query up into
smaller groups of UNION's.

--
Mark A. Parsons

Iron Horse, Inc. iron_horse@compuserve.com
Pegasys (200), Ltd pegasys@internet.co.nz