How can we retrieve all tables in database without data (as in, there are no rows in table) in the case of a Microsoft SQL Server?
Is there any method?
The screen capture shows that if you'd like to show an empty table cell in a cross-browser manner (IE7 and Firefox) using the 'separate' border model, you can use ' ' within a table cell to display the border of the empty table cell.
How do you search for a value in a database table when you don't have the exact value to search for? In such cases, the LIKE condition operator is used to select rows that match a character pattern. This is also called 'wildcard' search.
Try this
SELECT TableName=OBJECT_NAME(OBJECT_ID) ,Data_Rows= SUM(row_count)
FROM sys.dm_db_partition_stats
WHERE index_id in (0 ,1)
GROUP BY OBJECT_ID
HAVING SUM(row_count) = 0
OR If u need only user defined tables then use this
SELECT TableName=OBJECT_NAME(s.OBJECT_ID) ,Data_Rows= SUM(row_count)
FROM sys.dm_db_partition_stats s
JOIN sys.tables T
ON T.object_id = S.object_id
WHERE index_id in (0 ,1)
and T.type = 'U'
GROUP BY s.OBJECT_ID
HAVING SUM(row_count) = 0
SELECT '[' + SCHEMA_NAME(t.schema_id) + '].[' + t.name + ']' AS fulltable_name, SCHEMA_NAME(t.schema_id) AS schema_name, t.name AS table_name,
i.rows
FROM sys.tables AS t INNER JOIN
sys.sysindexes AS i ON t.object_id = i.id AND i.indid < 2 and i.rows=0
It will give table name and rows in that tables
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