因公司需要将多个schema下所有使用myisam引用的表更改为innodb引擎,所以就定了个存储过程来实现 delimiter // --存储过程中可以使用分号 drop procedure if exists `alter_engine`// -- 若已存在则删除 create procedure `alter_engine`(in schema_name_in
因公司需要将多个schema下所有使用myisam引用的表更改为innodb引擎,所以就定了个存储过程来实现
delimiter // --存储过程中可以使用分号
drop procedure if exists `alter_engine`// -- 若已存在则删除
create procedure `alter_engine`(in schema_name_in varchar(30)) --输入参数:schema名称
begin
declare alter_sql varchar(100); --用于获取游标查询生成的sql语句
declare stop_flag int; --游标循环是否结束的标志
/*获取指定schema下面使用MyISAM engine的表 , 并直接组装成 alter table table_name engine = InnoDB的SQl语句*/
declare table_name_cur cursor for select concat('alter table ',table_name,' ENGINE=InnoDB; ')
from information_schema.tables where table_schema = schema_name_in and engine = 'MyISAM';
/*循环结束标志*/
declare continue handler for not found set stop_flag = 1;
set stop_flag = 0;
采用C#.NET,多层架构开发,后台采用大型MS SQL SERVER 数据库和存储过程,速度、性能更胜一筹。 前台功能介绍: 1、网页首页显示有精品推荐,商业机会分类列表,最新供求信息,网站动态,最新企业等; 2、商业机会栏目功能有:二级分类,已经带有详细分类的数据库,后台可以更改增加操作; 3、展厅展品栏目功能:二级分类,已经带有详细分类的数据库,后台可以更改增加操作,栏目分为分类显示展示的产
0
open table_name_cur;
repeat
fetch table_name_cur into alter_sql;
if stop_flag = 0 then
/*prepare from 后面的变量必须是@开头*/
set @alter_sql = alter_sql;
prepare s1 from @alter_sql;
execute s1;
/*显示回收s*/
deallocate prepare s1;
end if;
UNTIL stop_flag = 1
END REPEAT;
CLOSE table_name_cur;
END;
//
/*切换回系统默认的命令结束标志*/
delimiter ;
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号