ITPub博客

首页 > 数据库 > PostgreSQL > PostgreSQL批量改数据类型

PostgreSQL批量改数据类型

原创 PostgreSQL 作者:哎呀我的天呐 时间:2022-08-17 16:46:19 0 删除 编辑

登录到所在库执行

select 'alter table '|| table_name || ' alter column ' || column_name || ' type varchar('|| character_maximum_length||');' as alter_integer_ddl
from information_schema.columns
where data_type like '%pbchar%'
-- and table_name not like '%sys_p%'
and table_schema = 'ta6xxxx'
order by table_name;


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29990276/viewspace-2910861/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
https://cloud.tencent.com/developer/inventory/14362

注册时间:2014-10-30

  • 博文量
    403
  • 访问量
    2528863