修改字段名称
-- 定义修改字段名称的存储过程
drop procedure if exists proc_changeColumn;
delimiter $$
create procedure proc_changeColumn(tableName varchar(50), oldColumnName varchar(50), ExeSql varchar(2000))
begin
declare cnt int default 0;
select count(*) into cnt from information_schema.columns where table_name = tableName and column_name = oldColumnName and table_schema = database();
set @SQL = ExeSql;
if (cnt > 0) then prepare stmt from @SQL;execute stmt; end if;
end
$$ delimiter ;