当前位置:网站首页>Batch capitalization of MySQL table names
Batch capitalization of MySQL table names
2022-06-24 20:29:00 【SugarPPig】
DROP PROCEDURE IF EXISTS upperTable;
DELIMITER $
CREATE PROCEDURE upperTable(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$
DELIMITER ;
Execute the stored procedure :
upperTable(' Database name ');
边栏推荐
- Oracle create tablespaces and tables
- 建立自己的网站(14)
- Q1: error in JMeter filename must not be null or empty
- Coinbase will launch the first encryption derivative for individual investors
- Vxlan and MPLS: from data center to Metro Ethernet
- [cann document express issue 06] first knowledge of tbe DSL operator development
- The first public available pytorch version alphafold2 is reproduced, and Columbia University is open source openfold, with more than 1000 stars
- Stop using system Currenttimemillis() takes too long to count. It's too low. Stopwatch is easy to use!
- Comparative analysis of arrayblockingqueue and linkedblockingqueue
- Clustered index (clustered index), nonclustered index (nonclustered index)
猜你喜欢

What is CNN (convolutional neural network)

Behind Tiantian Jianbao storm: tens of millions in arrears, APP shutdown, and the founder's premeditated plan to run away?

Q1: error in JMeter filename must not be null or empty

Using dynamic time warping (DTW) to solve the similarity measurement of time series and the similarity identification analysis of pollution concentration in upstream and downstream rivers

16个优秀业务流程管理工具

Bytebase加入阿里云PolarDB开源数据库社区

Error in Android connection database query statement

The latest simulated question bank and answers of the eight members (Electrical constructors) of Sichuan architecture in 2022

Where are Xiaomi mobile phone's favorite SMS and how to delete them
![[go language questions] go from 0 to entry 4: advanced usage of slice, elementary review and introduction to map](/img/3a/db240deb4c66b219ef86f40d4c7b7d.png)
[go language questions] go from 0 to entry 4: advanced usage of slice, elementary review and introduction to map
随机推荐
视频平台如何将旧数据库导入到新数据库?
物联网?快来看 Arduino 上云啦
Cooking business experience of young people: bloggers are busy selling classes and bringing goods, and the organization earns millions a month
It is said that Tencent officially announced the establishment of "XR" department to bet on yuanuniverse; Former CEO of Google: the United States is about to lose the chip competition. We should let T
两位湖南老乡,联手干出一个百亿IPO
Redis installation of CentOS system under Linux, adding, querying, deleting, and querying all keys
C language to realize mine sweeping (simple version)
Q1: error in JMeter filename must not be null or empty
Openvino2022 dev tools installation and use
The largest DPU manufacturer in history (Part 1)
Uninstall tool v3.5.10.5670 single file portable official version
Error in Android connection database query statement
Coinbase将推出首个针对个人投资者的加密衍生产品
Fuzzy background of unity (take you to appreciate the hazy beauty of women)
[go Language brossage] go from 0 to Getting started 4: Advanced use of slice, Primary Review and Map Getting started Learning
Openstack actual installation and deployment tutorial, openstack installation tutorial
With its own cells as raw materials, the first 3D printing ear transplantation was successful! More complex organs can be printed in the future
史上最全DPU厂商大盘点(上)
1、 Downloading and installing appium
gateway