SQL查询每个表的字段数量

--SQL查询每个表的字段数量
select b.[name], count(*) As AllCount,
ISNULL(ISNULL(sum(case when
isnullable=0 then 1 end),null),null) as NotNullCount
from syscolumns a
INNER JOIN
(
select [id], [name] from [sysobjects] where [type] = 'u'

) AS b ON a.id = b.[id]
GROUP by b.[name]
ORDER by AllCount asc

转载于:https://www.cnblogs.com/yufeng219/p/6247866.html

你可能感兴趣的:(SQL查询每个表的字段数量)