Suppose, that we have 2 databases: a and b, and tables a.test1 and b.test2.
If I need to insert a row into table a.test1, and return LAST_INSERT_ID() to insert into b.test2, will LAST_INSERT_ID() return value from another database? Is it reliable?
I didn't find anything in the manual, but @@IDENTITY depends on client session, so it should be portable between two databases. Isn't it?
LAST_INSERT_ID()always gives you the id of the row inserted by the lastINSERTstatement you executed on the current connection, irrespective of what table (and what database!) that row went into.