Re: SQL: How to select first N rows?
Posted in 1997
In article <3487AFEE.F1BC14AB@bull.net>, Helmut Leininger <Helmut.Leininger@bull.net> writes > > >Rajesh Ravindran wrote: > >> hi, >> >> 1. create a temp table. >> 2. do an insert select from that source table into this temp table. >> 3. Whenever u create a temp table & do an insert select the rows inserted >> would have rowid from 1 onwards serially. > >Not true. It may work for SE. But with Online the rowid's may be arbitrary >and surely do not start with 1. > > > Well, it sort of works in SE (4.10) the first time you insert data into a temp table the order in which the rows are inserted will follow the rowid. However, if you then delete all the data which you have just inserted and load in some more then the new rows start at the previous maximum rowid and data is loaded into rows in descending rowid sequence until the record with rowid = 1 has been inserted, at this point the next row will be inserted at previous maximum rowid + 1 with later rows being inserted in ascending rowid sequence. Bizarre! -- Steve Williamson