Just Code‎ > ‎

TSQL - Get name of tables in the database that have some rows

posted Feb 18, 2013, 5:08 AM by Peter Henell   [ updated Feb 18, 2013, 5:08 AM ]
I want to search my database to find the tables that have some rows in any of my tables named *_Audit.

This query will give approximate result. The row_count column is not exact.
SELECT object_name(object_id),* FROM sys.dm_db_partition_stats where object_name(object_id) like '%[_]audit%' and row_count > 10
Comments