select count(*) ‘总字段数‘,
ISNULL(ISNULL(sum(case when
isnullable=0 then 1 end),null),null) as ‘非空字段数‘
from syscolumns where id=object_id( ‘EmpInfo‘)
--空字段总数
SELECT
(
(SELECT COUNT(*) FROM syscolumns WHERE id=object_id(‘表名‘))-
(SELECT sum(CASE WHEN isnullable=0 then 1 end) FROM syscolumns
WHERE id=object_id(‘EmpInfo‘))
)as ‘空字段总数‘
原文地址:https://www.cnblogs.com/-NickWang/p/8364891.html
时间: 2024-10-13 15:58:43