Hari Gillala
Hari Gillala

Reputation: 11916

Guid Generation- SQL Latest Record

I know Guid are randomly generated, Is there any way I can find out which one is latest Guid? As I have to get the latest inserted record in my table as my table has no timeContext column.

Thank you

Upvotes: 0

Views: 113

Answers (1)

Damien_The_Unbeliever
Damien_The_Unbeliever

Reputation: 239704

No, you cannot get this information.

If you need information, such as when a row was inserted, then you need to add a column to your table to track that information.

If you're trying to mimic the "chained insert" style of inserts, where a row is inserted into one table, the IDENTITY() value is obtained, then used to insert into further tables, you can instead generate the Guid value before the first insert - indeed, it's one of the advantages of GUID identifiers that a whole set of related table changes can be prepared in isolation, without accessing the database at all.

Upvotes: 1

Related Questions