Is there any way to count tables with no rows in my database with using T-SQL statement?
There you go... using a derived table.
SELECT * FROM
(
 SELECT 
  [TableName] = so.name, 
  [RowCount] = MAX(si.rows) 
 FROM 
  sysobjects so, 
  sysindexes si 
 WHERE 
  so.xtype = 'U' 
  AND 
  si.id = OBJECT_ID(so.name) 
 GROUP BY 
  so.name 
) sub
WHERE sub.[RowCount] = 0
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With