mysql中的ident_current查询 [英] ident_current query in mysql

查看:661
本文介绍了mysql中的ident_current查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi
我需要mysql中的sql查询,其行为类似于sqlserver中的ident_current
它在mysql中不起作用
插入后我不想要它..有时我需要知道在某些表中插入的最后一个ID是什么

最好的问候

hi
i need a sql query in mysql which act like ident_current in sqlserver
it is not work in mysql
i dont want it after insert .. some times i need to know what is the last id inserted in some table

best regards

推荐答案

检查mysql_insert_id
http://in3.php.net/mysql_insert_id [
Check mysql_insert_id
http://in3.php.net/mysql_insert_id[^]


我需要知道哪个ID会插入新行"-这就是问题所在:有两个客户端连接到数据库,您会遇到并发问题.
当您需要在客户端上生成的ID时,请使用Guid-它们是唯一的,因此无论在何处生成它们都无关紧要.在MySQL中,没有Guid的数据类型,您可以将它们存储为CHAR(36).
"I need to know which id will insert new row" - that is the problem: when there are two clients connected to the database you run into concurrency problems.
When you need the ids generated on the clients, use Guids - they are unique and hence it does not matter where they are generated. In MySQL, there is no datatype for guids, you can store them as CHAR(36).


这篇关于mysql中的ident_current查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆