How do I get last record of Inserted rec if NOT using Identity col ? CUSTOM Query Insert using Sequences

In Hyperbytes’ new training video, https://www.youtube.com/watch?v=b8xr_gd6MMo&t=214s&ab_channel=Wappler
he has a 2nd step to add a Role record for a newly created User rec.
image

Its the same as these instructions from 2018: Get Inserted Record ID

But what about when I use a Custom Query INSERT INTO
and I’m on mariaDB or MSSQL, and use a Sequence instead of Identity column?

In my case I decided to do a Single Query right after, and fetch the record based on the unique UserEmail that just got registered. Then I use that ID for the Role insert.
image

Just wondering if I’m always going to be able to do this strategy - or if more support is coming for Sequences.

These sequences are relatively new in the DB world - MariaDB/2018 and MSSQL/2012.

Community Page
Last updated: