I'm in the middle of setting up a table, and I want to look at the count of how many 0 values each of the columns has. I've never used system views before... can I do something like this? (this doesn't work as entered, of course, it's just to convey intent):
SELECT t.COLUMN_NAME, (SELECT COUNT(ID) FROM tblKeyStatistics t2 WHERE
t2.ColumnName = t.COLUMN_NAME AND t2.ColumnName = 0) AS CountOf0
FROM INFORMATION_SCHEMA.COLUMNS t
WHERE TABLE_NAME = 'tblKeyStatistics'
So output would look like:
EntValue 2
TrailingPE 1
ForwardPE 11
With each of the integers being the count of 0 values in that column in the table.
Thanks in advance...