- 修复 SqlServer 支持 Chinese_PRC_CS_AS 区分小大写;#684

This commit is contained in:
2881099
2021-02-09 17:17:31 +08:00
parent 2dd722e507
commit d93fd91eed
11 changed files with 131 additions and 131 deletions

View File

@ -254,17 +254,17 @@ ELSE
var sql = string.Format(@"
use [{0}];
select
a.name 'Column'
a.name 'column'
,b.name + case
when b.name in ('Char', 'VarChar', 'NChar', 'NVarChar', 'Binary', 'VarBinary') then '(' +
when b.name in ('char', 'varchar', 'nchar', 'nvarchar', 'binary', 'varbinary') then '(' +
case when a.max_length = -1 then 'MAX'
when b.name in ('NChar', 'NVarchar') then cast(a.max_length / 2 as varchar)
when b.name in ('nchar', 'nvarchar') then cast(a.max_length / 2 as varchar)
else cast(a.max_length as varchar) end + ')'
when b.name in ('Numeric', 'Decimal') then '(' + cast(a.precision as varchar) + ',' + cast(a.scale as varchar) + ')'
else '' end as 'SqlType'
,case when a.is_nullable = 1 then '1' else '0' end 'IsNullable'
,case when a.is_identity = 1 then '1' else '0' end 'IsIdentity'
,(select value from sys.extended_properties where major_id = a.object_id AND minor_id = a.column_id AND name = 'MS_Description') 'Comment'
when b.name in ('numeric', 'decimal') then '(' + cast(a.precision as varchar) + ',' + cast(a.scale as varchar) + ')'
else '' end as 'sqltype'
,case when a.is_nullable = 1 then '1' else '0' end 'isnullable'
,case when a.is_identity = 1 then '1' else '0' end 'isidentity'
,(select value from sys.extended_properties where major_id = a.object_id AND minor_id = a.column_id AND name = 'MS_Description') 'comment'
from sys.columns a
inner join sys.types b on b.user_type_id = a.user_type_id
left join sys.tables d on d.object_id = a.object_id