Search code examples
windev

Get the last inserted row ID (HFSQL)


I need to get the Id(Auto Incremented) created for an inserted Row

How i can do that the documentation mentioned LAST_INSERT_ID but i don't know how to use it , i tried this but it does not work :

Insert into tab1 (tab1.Name) values('foo')
SELECT LAST_INSERT_ID ()

Solution

  • Try this :

    Insert into tab1 (tab1.Name) values('foo')
    SELECT LAST_INSERT_ID() FROM tab1 LIMIT 1