select
' ALTER TABLE ' + sys.tables.name + ' ALTER COLUMN ' +
sys.columns.name + ' ' + sys.types.name + '(' +
cast(sys.columns.max_length as varchar) + ')' + ' COLLATE' +
' Chinese_PRC_CI_AS'
+ case sys.columns.is_nullable
when '1' then ' NULL'
else ' not NULL'
end +';' as ifallownull
,sys.tables.name as tablename,sys.columns.name as 字段名, sys.types.name as 字段类型, sys.columns.max_length as 长度, sys.columns.collation_name,sys.columns.is_nullable as 是否可空
from sys.columns, sys.tables, sys.types
where sys.columns.object_id = sys.tables.object_id
and sys.columns.system_type_id = sys.types.system_type_id
and sys.columns.collation_name is not null
06-13
1113
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
12-10
1399
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)