select count(*) 总字段数,
ISNULL(ISNULL(sum(case when
isnullable=0 then 1 end),null),null) as 非空字段数
ISNULL(ISNULL(sum(case when
isnullable=0 then 1 end),null),null) as 非空字段数
from syscolumns where id=object_id( 't_User ')
//空字段总数
SELECT
(
(SELECT COUNT(*) FROM syscolumns WHERE id=object_id('t_User'))-
(SELECT sum(CASE WHEN isnullable=0 then 1 end) FROM syscolumns WHERE id=object_id('t_User'))
)