Re: CREATE TEMP TABLE LIKE mytable.*
Posted in 1994
In article <3ao8hq$rv1@infmx.informix.com> proberts@informix.com (Paul Roberts)
writes:
>In article <WBpokq4b9RLH073yn@kcbbs.gen.nz> kerry@kcbbs.gen.nz (Kerry
> Sainsbury) writes:
>>
>> SELECT prodno, desc FROM product
>> WHERE ROWID = -1
>> INSERT INTO TEMP mytemp>
>Or just:
>
> select *
> from real_tab
> where 1 = 2
> into temp temp_tab with no log ;
Note that each of the above methods is a query for which the engine will
attempt to find all rows that satisfy the WHERE clause.
In the first case, the index on ROWID will be used, which will cause the
query to execute quickly. Hopefully no ROWID will exist equal to (-1).
I'm fairly certain you can count on this with SE, but I don't know with
OnLine. Anyone know for sure?
The second query could take a long time on a large table, since the
search will be sequential. At least it did on my system, which runs SE,
when I tried a WHERE clause of "1 <> 1".
It looks like the ROWID method would probably be the better general solution,
so long as there exists a value like (-1) that will never be assigned to
ROWID.
Walt.
--
Walt Hultgren Internet: walt@rmy.emory.edu (IP 128.140.8.1)
Emory University UUCP: {...,gatech,rutgers,uunet}!emory!rmy!walt
954 Gatewood Road, NE BITNET: walt@EMORY
Atlanta, GA 30329 USA Voice: +1 404 727 0648