我是靠谱客的博主 阔达大象,这篇文章主要介绍mysql 禁止存储过程,MySQL在存储过程中禁用auto_increment列临时,现在分享给大家,希望可以做个参考。

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内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(52)

评论列表共有 0 条评论

立即
投稿
返回
顶部