Dynamic SQL:
DECLARE @SQL nvarchar(max);
SELECT
@SQL = IsNull(@SQL + ' OR ', '') + QuoteName(Column_Name) + ' IS NULL'
FROM
INFORMATION_SCHEMA.COLUMNS
WHERE
Table_Name = 'YourTable'
AND Table_Schema = 'YourSchema';
EXEC ('SELECT Count(*) FROM YourSchema.YourTable WHERE ' + @SQL);
Another way:
SET ANSI_NULLS OFF; -- deprecated in SQL 2005 - 2012, will eventually be removed
SELECT Count(*) FROM YourSchema.YourTable WHERE NULL IN (Col1, Col2, Col3, Col4 ... Col80);
And yet another way, assuming your column names don't have space character in them:
In SSMS, navigate to the table in the object browser and drop open the column list. Drag the "Columns" folder to a query window. Use search and replace to change all the spaces in the selection to IS NULL OR
. Prepend the following code and run it!
SELECT Count(*) FROM YourSchema.YourTable WHERE [put modified column list here]