Today we ran into a problem with @@identity returning the wrong value for the newly created row.
I found that using @@identity will return the identity column of the LAST inderted row for the current session. On our table we had a trigger that will craete rows in another table, and @@identity would return the identity value of that second table.
The fix for this is to use SCOPE_IDENTITY() function.
SCOPE_IDENTITY(), like @@IDENTITY, will return the last identity value created in the current session, but it will also limit it to your current scope as well. In other words, it will return the last identity value that you explicitly created, rather than any identity that was created by a trigger or a user defined function.
see: http://www.dotnetjunkies.com/Article/86F0988E-FED4-414F-BA2E-D01D953C11BE.dcik9