刚坐在车里就开始电闪雷鸣。听着隆隆的雷声,没有恐慌,到有几分振奋人心的舒心感、酣畅淋漓感。朝外望去,突然间,狂风夹杂着骤雨席卷而来,一泻千里。瞬间暴雨如注,打在地上,溅起朵朵浪花,在热浪的蒸腾下激起层层水雾。满大街是慌乱的人群,行人跑着、叫喊着,唧唧喳喳的赶着在房檐下躲雨。这时候伞是没有用的,挡不住狂风暴雨的袭击,无论是带了伞的,还是没带伞的,全都躲在了房檐下。
本文为大家分享了MYSQL将表名称修改成大写的存储过程,具体内容如下
1. 条件:
1.1 Mysql设置对大小写敏感
2. 执行下述存储过程:
#call uppercase('库名') DROP PROCEDURE IF EXISTS uppercase; CREATE PROCEDURE uppercase(IN dbname VARCHAR(200)) BEGIN DECLARE done INT DEFAULT 0; DECLARE oldname VARCHAR(200); DECLARE cur CURSOR FOR SELECT table_name FROM information_schema.TABLES WHERE table_schema = dbname; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; OPEN cur; REPEAT FETCH cur INTO oldname; SET @newname = UPPER(oldname); SET @isNotSame = @newname <> BINARY oldname; IF NOT done && @isNotSame THEN SET @SQL = CONCAT('rename table `',oldname,'` to `', LOWER(@newname), '_tmp` '); PREPARE tmpstmt FROM @SQL; EXECUTE tmpstmt; SET @SQL = CONCAT('rename table `',LOWER(@newname),'_tmp` to `',@newname, '`'); PREPARE tmpstmt FROM @SQL; EXECUTE tmpstmt; DEALLOCATE PREPARE tmpstmt; END IF; UNTIL done END REPEAT; CLOSE cur; END
3. 执行一下语句
call uppercase('库名');
到此这篇关于MYSQL将表名称修改成大写的存储过程就介绍到这了。生命之舟面对险滩,面对激流,弱者会选择逃避和放弃,而强者则会选择面对和挑战。人生中无限的乐趣都在于对人生的挑战之中迸出不衰的光芒。更多相关MYSQL将表名称修改成大写的存储过程内容请查看相关栏目,小编编辑不易,再次感谢大家的支持!