I have an SQL Server query that needs to count the number of rows returned, but I need to disregard rows where all the column values are NULL. Some rows have NULL values for some of the columns, but that is ok. I just need to filter out the ones that have ALL NULL values.
Right now I am returning all rows and using a SqlDataReader iterating the returned rows and counting the ones I need. I would like to move this into the query itself if possible.
Thanks!
EDIT: What I am trying to do is similar to this, but I am apparently having a hard time making the VS SQL editor recognize what I'm doing:
SELECT COUNT(sd.[ID])
FROM [Some Data] sd
WHERE sd.[Data Name] = 'something' AND ((sd.q1 IS NOT NULL) OR (sd.q2 IS NOT NULL))
etc..