我的tsql数据表中有一个表:
CREATE TABLE dbo.Test
(
Col nVarChar (50) null
)
GO
然后我执行了查询:
Select
c.name As Name, ty.name as Type, c.max_length As MaxLenght, c.precision As Precision, c.scale As Scale, c.is_nullable As IsNullable, *
From
sys.schemas s
inner join sys.tables t on s.schema_id = t.schema_id
inner join sys.columns c on t.object_id = c.object_id
inner join sys.types ty on ty.system_type_id = c.system_type_id
Where
s.name LIKE 'dbo' AND t.name LIKE 'Test'
问题是......为什么有Two Rows?!
答案 0 :(得分:0)
检查一下:
SELECT ROW_NUMBER() OVER(PARTITION BY system_type_id ORDER BY system_type_id)
, *
FROM sys.types;
检查第一列的值> 1 ...
映射到同一system_type_id
的类型很少。某些名称只是别名的其他内容......
This question解决了同样的问题......