我是靠谱客的博主 阔达大象,最近开发中收集的这篇文章主要介绍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 禁止存储过程,MySQL在存储过程中禁用auto_increment列临时所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

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

评论列表共有 0 条评论

立即
投稿
返回
顶部