SQL Server

Don’t use @@Identity

Don’t use @@Identity to select the ID of the newly inserted record, use scope_identity() instead.

@@Identity returns the most recently created identity for your current connection. When you first use it, it might be fine, but if someone adds a trigger that causes another identity to be created, that one will be the one which is returned.