Answered Questions

  • Recent row entered

    I have a very unusual question, how can one check which is the recent row added to a table?

    Star Read Best Answer

    Editorial / Best Answer


    • Member Since Jul-2008 | Aug 6th, 2008

    We can select the recent row enrtered by using the query below.
    suppose the table name is employee;
    select * from employee where rowid=(select max(rowid) from employee).
    This works fine because rowid is assigned for each and every record and in accending order. So the recent record's rowid is the man (rowid). Please send feedback with any concern.


    • May 31st, 2010

    "Although a rowid uniquely identifies a row in a table, it might change its value if the underlying table is an index organized table or a partitioned table." Also rowid stores information a...


    • Aug 26th, 2009

    SCOPE_IDENTITY() would be a better option to get the most recently added row as the primary key for a table may not necessarily be an auto-incrementing variable. Therefore max(rowid) would not be the optimal solution in that case.