Get last inserted row ID

I would like to inquire about best practices for getting the row ID of the last inserted Row.

Currently our team is using a GUID field in nearly every table where our program needs to receive the Row ID after insertion. Every other commercial database I have worked with allows for some iteration of
SELECT last_insert_rowid();
which will return the value of the auto incremented ID field. Is there any support for this type of command with the 4D SQL Engine? If not are we currently using the best practice to get the row ID after insertion?

Any advice would be much appreciated!

OS : Windows
Product :4D - 4D Server

SQL is not native in 4d, it is a recent overlay.

Is there a way you would suggest handling it in Native 4D query language? I am more than happy to use whatever fits the case best.

In the legacy 4D langage, number> is “a kind of” rowID, but when a record is deleted that row ID becomes free and will be used for the next record to be added.

In SQL you have virtual fields>; I suppose (I never checked) the higher __ROW_STAMP is the last added record.

About using primary keys (PK) to get the last added, if a table has a PK in a longint type field, “by chance” the last added is the higher PK (sequence counter). But if the table has a UUID type field as PK, it doesn’t give the information. IMHO, a PK only has to be unique, and the more unique it is, the better it is.