How do I get the count of null value columns per row in a return set?

前端 未结 7 1737
臣服心动
臣服心动 2021-01-21 17:46

I\'m looking for a query which will return me an extra column at the end of my current query which is the count of all columns within the return set which contain a null column.

7条回答
  •  悲&欢浪女
    2021-01-21 18:11

    select count(*) - count(ColumnName) as NumberOfNulls from yourTable
    

    returns number of nulls in specific column. if you do this for every column you can get that data.

提交回复
热议问题