批量修改字符集

select 'alter table ['+table_name + '] alter column ['+ column_name+ '] '+data_type+'('+cast(CHARACTER_MAXIMUM_LENGTH as varchar(10))+')' +' collate SQL_Latin1_General_CP1_CI_AS'  
from     information_schema.columns where  TABLE_CATALOG='dior' and  COLLATION_NAME='Chinese_PRC_CI_AS'
and data_type not in ('text','ntext') and CHARACTER_MAXIMUM_LENGTH<>-1 and table_name not like '%bak%' and table_name not like '%delete%'

posted @ 2021-07-07 19:33  KJXY  阅读(55)  评论(0)    收藏  举报