sqlserver数据字典

SELECT
	t.name tableName
	,c.name columnName
	,ty.name type
	,CASE 
		WHEN ty.name='nvarchar' THEN c.max_length/2 
		WHEN ty.name='decimal' THEN c.precision 
			ELSE c.max_length 
	END size
FROM hc.sys.tables t JOIN hc.sys.columns c ON t.object_id=c.object_id JOIN hc.sys.types ty ON c.user_type_id=ty.user_type_id 
WHERE t.type=N'U' AND t.name='HCYSJ20180501'

 

你可能感兴趣的:(sqlserver数据字典)