In sql server there is a something like
IDENTITY_INSERT is set to OFF and we can set in ON after
I wanna know is that something similar in mysql where i need to temporary set off and set ON i.e like
create procedure ()
begin
IDENTITY_INSERT is set to OFF
Some insert statement
Some insert statement
IDENTITY_INSERT is set to ON
end
解决方案
I can't imagine any good reason why you need to switch that off.
If you need to insert any record with your custom id AUTO_INCREMENT is not a barrier.
CREATE TABLE t1 (id int NOT NULL AUTO_INCREMENT, PRIMARY KEY (id));
INSERT INTO t1 VALUES (23);
INSERT INTO t1 VALUES (null);
So why do you need to switch it off?
最后
以上就是阔达大象最近收集整理的关于mysql 禁止存储过程,MySQL在存储过程中禁用auto_increment列临时的全部内容,更多相关mysql内容请搜索靠谱客的其他文章。
发表评论 取消回复