Subject Re: [ib-support] IN limitation to 1500 ?
Author Paul Schmidt
On 28 Dec 2001, at 20:30, Artur Anjos wrote:

> Hehehe. Let's start again the discussion 'Why do I need temporary
> tables?'
> For this to work, he must save first the 1500+ id's that he have...
> > I saw this message and some of the replies, usually when you
> > bump into a limit like this, then it really means that your going
> > about it the wrong way. For example rather then using SELECT .. IN
> > ... and putting a bunch of values in a selection list, then perhaps
> > you should put the selection list into a table, and then use some
> > plain SQL like this:
> >
> > SELECT fields FROM table1
> > JOIN table2 on table1.value = table2.value
> >
> > This will save you shipping those 1500+ values across to the server
> > every time you run the query.

It really depends on how the values are obtained in the first place,
for example if they are fairly static, then write them into a table and
leave it at that, otherwise, simply assign it a session id, and delete
anything that uses that id, when your done. No temporary tables
involved. Too bad, you can't read the value of a generator, that
would be a good way to assign session id's. There are probably
other ways to do it, as well. For example is there a logical way to
determine these values, that could be done using a UDF for
example if it's a sequence of numbers like 1,2,3.. 1750 then a UDF
could be written that outputs the sequence. Perhaps a Stored
Procedure could be used to obtain sets of values, or maybe several

I said before, and I will say again, temp tables are for tools that
don't handle SPs and views properly.

Paul Schmidt
Tricat Technologies