本站中文解释
_insert
MySQL参数identity_insert 是弱类型关系型数据库(RDBMS)中用来控制能否插入已经有定义的自增长的列的参数。
当一个用户打开identity_insert选项时,他/她可以给定自增长的列表添加预定义的数据,并使用这些数据替换其默认自增长值。对于每个表,只有一个用户可以激活自增长选项;其他用户不能设置或改变这个参数。
要设置identity_insert,可在MySQL命令行工具以及其他的MySQL客户端中,输入:
SET IDENTITY_INSERT [database_name].[table_name] ON;
其中database_name和table_name必须为用户要使用的database_name和table_name
要关闭identity_insert,可输入:
SET IDENTITY_INSERT [database_name].[table_name] OFF;
这样就可以更改identity_insert参数设置,以及允许或禁止插入已经有定义的自增长的列。
官方英文解释
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
.