title: mysql @@identity vs sql-server last_insert_id()
body: <p>Am I correct in understanding that mysql's LAST_INSERT_ID() function doesn't reset between insert attempts (as @@identity does in sql-server)... that if the immediately preceding insert operation fails, LAST_INSERT_ID() will return the pk of whatever the pk of that connection's last insert to <strong><em>any</em></strong> table with an auto-incrementing primary key was.  And if I am correct in this, does this not seem like just about the most retarded behaviour for this function that one could come up with?  Is there no mysql function that behaves similarly to sql-server's @@identity?  One that will return NULL if the <strong><em>immediately preceding</em></strong> insert attempt creates no new record?  Alternatively, how does one know with certainty the primary key of the most recent insert operation?</p>