I have a table with 250 columns and 10 000 000 rows. I want to display all the columns that doesn't have a value except for the default value.
I'm looping through the syscolumns for the table SalesTransactions by using select count like below, I'm checking what data type it is and I have different conditions for each column type. (Int and varchar in this example)
SELECT COUNT(*) From SalesTransactions WHERE CustomerNo >0
SELECT COUNT(*) From SalesTransactions WHERE CustomerName <>''
This works fine on table with not so many rows. Is there a more efficient way to count rows than using select count(*) for each column ?
I don't care to know the exact numer of rows, I'd rather just display columns that doesn't have values.
Any suggestions ?