I am familiar with the MySQL function LAST_INSERT_ID; is there a similar function to execute the same query with the MS Access database via ODBC?
In my particular case, I use PHP + PDO to insert rows into the Access database and would like to know the last primary key value for each insert when they are executed.
If this feature is not available, are there any alternatives? (without changing the database)
Thank.
Access 2000 or later seems to support the property @@IDENTITY. Thus, you will need to select its value after INSERT:
@@IDENTITY
select @@IDENTITY from myTable
. MSDN: Retrieving Identity or Autonumber Values
Retrieving Identity or Autonumber Values
:
[...] Microsoft Access 2000 @@IDENTITY Autonumber INSERT. RowUpdated, , INSERT, @@IDENTITY DataSet.
, SELECT @@IDENTITY Jet 4 ACE.
SELECT @@IDENTITY
Access 2010 , , ACE , . , , @@IDENTITY . , SQL Server SCOPE_IDENTITY().
Access, , , . , , ACCDB .
php, : . max (id) , , , . -, odbc_cursor (http://au2.php.net/manual/en/function.odbc-cursor.php).
Try running "SELECT @@ IDENTITY FROM MyTable" after your insert.
Source: https://habr.com/ru/post/1773873/More articles:Destroy XML into a C # Object - c #jQuery replace element text - javascriptWhy is the Erlang driver driver different than expected? - cHow to handle foreign languages? - htmlhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1773872/is-it-possible-to-add-custom-data-detectors-to-osx-cocoa-applications-such-as-mailapp-safari&usg=ALkJrhiPB1mVBk7B-x-MABWndWlyXxCDoQUser request for confirmation in the middle of the process - javascriptVariable naming for multidimensional arrays (PHP) - phpЕсть ли более эффективный способ сортировки двух чисел? - c++Variadic Templates: Package options without extension - c ++How to use lambda expression parameter in sub expression? - c #All Articles