純粋な Transact SQL (TSQL の一部ではない動的 SQL 呼び出しを使用しない):
SELECT CASE WHEN c1 IS NULL THEN 0 ELSE 1 END + CASE WHEN c2 IS NULL THEN 0 ELSE 1 END + CASE WHEN c3 IS NULL THEN 0 ELSE 1 END + CASE WHEN c4 IS NULL THEN 0 ELSE 1 END + CASE WHEN c5 IS NULL THEN 0 ELSE 1 END + CASE WHEN c6 IS NULL THEN 0 ELSE 1 END + CASE WHEN c7 IS NULL THEN 0 ELSE 1 END + CASE WHEN c8 IS NULL THEN 0 ELSE 1 END FROM T
プレ>