mysql里头也有.
楼主不妨直接查询mysql的官方文档.
mysql5.5的chm帮助是这么说的:identity
This variable is a synonym for the last_insert_id variable. It exists for compatibility with other database systems. You can read its value with SELECT @@identity, and set it using SET identity. 再看看:
last_insert_id The value to be returned from LAST_INSERT_ID(). This is stored in the binary log when you use LAST_INSERT_ID() in a statement that updates a table. Setting this variable does not update the value returned by the mysql_insert_id() C API function. 这两者是完全一样的.
楼主不妨直接查询mysql的官方文档.
mysql5.5的chm帮助是这么说的:identity
This variable is a synonym for the last_insert_id variable. It exists for compatibility with other database systems. You can read its value with SELECT @@identity, and set it using SET identity. 再看看:
last_insert_id The value to be returned from LAST_INSERT_ID(). This is stored in the binary log when you use LAST_INSERT_ID() in a statement that updates a table. Setting this variable does not update the value returned by the mysql_insert_id() C API function. 这两者是完全一样的.
唯一区别的@@identity是sql server ,而last_insert_id()
是my sql,identity是跟last_insert_id的区别是如果出现insert多条记录的时候,一个是取这个事务的最前面的哪个,一个是取这个事务的最后一个.
last_insert_id()是取数据最后一下。而@@identity是顺序取数据的。
再说一遍, identity 是 last_insert_id的同义词.
再说一遍, identity 是 last_insert_id的同义词.
嗯,就是问mysql的,呵呵,因为网上有很多都说mysql也是这么区分的,所以我有点没谱了,说法太多了,但是昨天我用自己的库测了下发现这俩基本是一个东西,identity 也不像是个全局的,因为新建个客户端查询的identity 就是0了,所以不放心就问了下,谢谢啦