Alex Gordon
Alex Gordon

Reputation: 60691

mysql/sql server: SELECT @@identity

is there a difference in the way this functions between the two databases mysql and sql server:

SELECT @@identity

Upvotes: 2

Views: 1936

Answers (2)

Rawheiser
Rawheiser

Reputation: 1220

Yes: Since that doesn't appear to be in the ANSI SQL standard, it is left to the DBMS vendor to roll their own methods.

mysql_insert_id() 

Upvotes: 1

Joe Stefanelli
Joe Stefanelli

Reputation: 135789

I prefer SCOPE_IDENTITY() in SQL Server to avoid issues with triggers.

Upvotes: 4

Related Questions