首页 > 数据库 > PostgreSQL > PostgreSQL批量改数据类型
登录到所在库执行
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/ ,如需转载,请注明出处,否则将追究法律责任。