Home Forums SQL Server 2005 Administering How To Get Last Inserted Record Value In SQL Server RE: How To Get Last Inserted Record Value In SQL Server

  • Scott Coleman (4/28/2010)


    An IDENTITY column will help you find the most recently-inserted row

    Possibly it will if your inserts are serialized. If you have multiple connections with multi-statement transactions then it all depends how you define "most recent". It is quite possible to have identity values interleaved from two near-simultaneous operations for example even though one of them could commit before the other. I think it is safest to assume IDENTITY order is non-deterministic and will not necessarily match insertion order (whatever "insertion order" means) except in the special case of a single connection inserting one row at a time.