aciobanita constantin wrote:
which is better?
Select @@identity or select MAX()
Hhmmm... This question is not well formulated. The context of usage of
@@identity
or
MAX()
depends on many factors.
If you would like to find max value in table, use
MAX
function, but... If you would like to newly added record, use
@@identity
.
For further information, please see:
MS Access - MAX() function[
^]
Retrieving Identity or Autonumber Values[
^] +
How to retrieve last autoincremented value in MS-Access like @@Identity in Sql Server[
^]
You may want to get latest value using
MAX
function, but i need to warn you: in multi-user environment,
MAX
function can return wrong value. Imagine, a time needed to add new record and to return
MAX
value is counted in miliseconds. In MS Access database changes are made locally, so...
Well, as you can see, none of above is "better" or "worse".