Triggers
Using @@identity depends on the fact that there are no triggers in your database that create entries elsewhere.
If you create an entry, but the trigger then creates a log entry to create, @@identity will return you the log entry id in the log table.
source share