select temp table in original order
Posted in 2010
Topics: General Discussion
We need to process a file after loading it into a temp table. Is there any way to select data from the temp table in original order? No field of the file can be used for 'order by'. IDS version is 11.50.UC5. Thanks in advance. Gary
Add a SERIAL column to the temp table and just insert all of the other
columns ignoring the SERIAL column, it will populate itself. Then you can
SELECT from the temp table ORDER BY the SERIAL column to get the original
ordering:
> create temp table fred( one serial, two int );
Temporary table created.
> insert into fred(two) values(1);
1 row(s) inserted.
> insert into fred(two) values(19);
1 row(s) inserted.
> select * from fred order by one;
one two
1 1
2 19
2 row(s) retrieved.
Art
Art S. Kagel
Advanced DataTools (www.advancedatatools.com)
IIUG Board of Directors (art@iiug.org)
Blog: http://informix-myview.blogspot.com/
Disclaimer: Please keep in mind that my own opinions are my own opinions and
do not reflect on my employer, Advanced DataTools, the IIUG, nor any other
organization with which I am associated either explicitly, implicitly, or by
inference. Neither do those opinions reflect those of other individuals
affiliated with any entity with which I am affiliated nor those of the
entities themselves.
On Mon, Dec 13, 2010 at 11:07 PM, GARY GU <garyg@selectsoftware.com.au>wrote:
> We need to process a file after loading it into a temp table. Is there any
> way
> to select data from the temp table in original order? No field of the file
> can
> be used for 'order by'. IDS version is 11.50.UC5.
>
> Thanks in advance.
> Gary
>
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
--20cf30433efe0b272a04975cd7dd
add an identity field (serial*) and use that for sorting. Regards. On Tue, Dec 14, 2010 at 4:07 AM, GARY GU <garyg@selectsoftware.com.au>wrote: > We need to process a file after loading it into a temp table. Is there any > way > to select data from the temp table in original order? No field of the file > can > be used for 'order by'. IDS version is 11.50.UC5. > > Thanks in advance. > Gary > > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > > -- Fernando Nunes Portugal http://informix-technology.blogspot.com My email works... but I don't check it frequently... --000e0cd1fc104139720497663dc2