修復(fù)mysql數(shù)據(jù)庫(kù)自增字段的AUTO_INCREMENT起始值的存儲(chǔ)過(guò)程_MySQL
來(lái)源:懂視網(wǎng)
責(zé)編:小采
時(shí)間:2020-11-09 19:27:19
修復(fù)mysql數(shù)據(jù)庫(kù)自增字段的AUTO_INCREMENT起始值的存儲(chǔ)過(guò)程_MySQL
修復(fù)mysql數(shù)據(jù)庫(kù)自增字段的AUTO_INCREMENT起始值的存儲(chǔ)過(guò)程_MySQL:delimiter $$create procedure repair_auto_increment(IN db varchar(10)) begin declare tmp_name char(30) default ; declare tmp_cursor cursor for select TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=db; DECLARE CONTINUE HANDLER
導(dǎo)讀修復(fù)mysql數(shù)據(jù)庫(kù)自增字段的AUTO_INCREMENT起始值的存儲(chǔ)過(guò)程_MySQL:delimiter $$create procedure repair_auto_increment(IN db varchar(10)) begin declare tmp_name char(30) default ; declare tmp_cursor cursor for select TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=db; DECLARE CONTINUE HANDLER
delimiter $$create procedure repair_auto_increment(IN db varchar(10)) begin declare tmp_name char(30) default ""; declare tmp_cursor cursor for select TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=db; DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET tmp_name = null; open tmp_cursor; fetch tmp_cursor into tmp_name; while(tmp_name is not null) do set @sql = concat('alter table ', tmp_name); set @sql = concat(@sql, ' auto_increment=1'); prepare stmt from @sql; execute stmt; fetch tmp_cursor into tmp_name; end while; close tmp_cursor; end$$delimiter ;
聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問(wèn)題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com
修復(fù)mysql數(shù)據(jù)庫(kù)自增字段的AUTO_INCREMENT起始值的存儲(chǔ)過(guò)程_MySQL
修復(fù)mysql數(shù)據(jù)庫(kù)自增字段的AUTO_INCREMENT起始值的存儲(chǔ)過(guò)程_MySQL:delimiter $$create procedure repair_auto_increment(IN db varchar(10)) begin declare tmp_name char(30) default ; declare tmp_cursor cursor for select TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=db; DECLARE CONTINUE HANDLER