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.

Have a look at this thread and video

A custom query still returns “Identity” and “Affected” in the same way as any other insert query, no need for the select.
Sequences are not supported by Wappler and I suspect will not until they are commonly adopted across all common DB platforms for continuity reasons

1 Like

Here’s my Insert stmt “insert_people”
image

This is where I would have selected Identity for my value in the Conditions tab.
image

I don’t have an option to select Identity, which is why I posted.
It must be because of the lack of an Identity field in this table?

Thx Brad,
I understand that concept, but from my post below, I don’t have the “Identity” and “#Affected” fields showing up under my Query.
Don’t know why.
He shows this technique in his new video I referred to in the OP. Same thing.

So you insert_people action inserts into the role table?
Do you have an auto increment field in the role table?
identity returns the value allocated to a auto increment field, without one there will be no returned value.
I am sure you have a reason but you seem to have make a very simple procedure unnecessarily complex by trying to use an unsupported technology.