The question is simple:
Is it possible to retrive all the tables that are not empty ?
I need a query to list the tables. Is there a way ?
Thanks to support
The question is simple:
Is it possible to retrive all the tables that are not empty ?
I need a query to list the tables. Is there a way ?
Thanks to support
Try this Script To get all tables with non empty records
    USE [Your database Name]
    Go
    SELECT SCHEMA_NAME(schema_id) AS [SchemaName],
            [Tables].name AS [TableName]
            --SUM([Partitions].[rows]) AS [TotalRowCount]
    FROM sys.tables AS [Tables]
    JOIN sys.partitions AS [Partitions]
        ON [Tables].[object_id] = [Partitions].[object_id]
        AND [Partitions].index_id IN ( 0, 1 )
    -- WHERE [Tables].name = N'name of the table'
    GROUP BY SCHEMA_NAME(schema_id), [Tables].name
    HAVING SUM([Partitions].[rows]) >0
Slightly different than @Sreenu131 answer as it is using sys.partitions .rows property to find
p.rows > 0
SELECT 
    sch.name as SchemaName,
    t.NAME AS TableName,
    p.rows AS RowCounts
FROM 
    sys.tables t
INNER JOIN 
    sys.partitions p ON t.object_id = p.OBJECT_ID 
INNER JOIN sys.schemas sch
    on t.schema_id = sch.schema_id
WHERE 
    t.NAME NOT LIKE 'dt%' 
    AND t.is_ms_shipped = 0
    AND p.rows > 0
GROUP BY 
    sch.name,t.Name, p.Rows
ORDER BY 
    sch.name,t.Name