Hello, how can i retrive the last autoinc value which is generated by inserting of my latest record in a TUniTable or TUniQuery?
if i post a insert script manually then can i use the MS SQL script variable @@IDENTITY.
However, if i use e.g., TUniTable.Insert + TUniTable.Post, how can i get the value then?
MS SQL Azure, last autoinc value with TUniTable/TUniQuery
Re: MS SQL Azure, last autoinc value with TUniTable/TUniQuery
After inserting record in the TUniTable dataset you can get auto-increment field value from the TUniQuery.LastInsertId:
Https://www.devart.com/unidac/docs/inde ... sertid.htm
Https://www.devart.com/unidac/docs/inde ... sertid.htm
Re: MS SQL Azure, last autoinc value with TUniTable/TUniQuery
Thanks for reply.
From your link:
As long i use TUniQuery like TUniTable, only with additional SQL filters, have i a solution (over the DoAfterPost methode) which work with most of my tables where i have a default identity field which have always the same name.
However, i would appreciate a native solution from your side.
From your link:
But, i use SQL Server and Azure, where the property is always zero.Can be used with MySQL and PostgreSQL servers to get the value of the ID field after executing INSERT statement.
As long i use TUniQuery like TUniTable, only with additional SQL filters, have i a solution (over the DoAfterPost methode) which work with most of my tables where i have a default identity field which have always the same name.
However, i would appreciate a native solution from your side.
Re: MS SQL Azure, last autoinc value with TUniTable/TUniQuery
Your solution is correct and we cannot propose anything better.