首页 » 数据库

批量生成多个表 修改字段类型的语句

   发表于:数据库评论 (0)   热度:2023

 

select concat('alter table ', table_name, ' modify ', column_name, ' bigint') from information_schema.columns where table_schema = 'shop_ceshi' and column_name = 'product_id';

执行结果:

alter table shop_product modify product_id bigint ;
alter table shop_product_attr_index modify product_id bigint;
#......
alter table shop_product_browse modify product_id bigint;

然后复制执行结果, 执行, 成功

(。・v・。)
喜欢这篇文章吗?欢迎分享到你的微博、QQ群,并关注我们的微博,谢谢支持。