Find fields that aren't used (have all nulls)

前端 未结 3 627
一生所求
一生所求 2020-12-22 10:21

I\'ve inherited a legacy database, and many, many fields are no longer being used. I can tell by querying on the last couple of years and seeing which fields are null, to at

3条回答
  •  死守一世寂寞
    2020-12-22 11:06

    This gives you the count of all records with NULL fields which you can compare to the count of all the records

    SELECT COUNT(*)
    FROM Table1
    WHERE COALESCE (Field1, Field2, etc) IS NULL
    

提交回复
热议问题