geri222
8/13/2018 - 7:22 AM

which tables have data

SELECT  [Name]      = o.name
    ,     [RowCount]  = SUM(p.row_count)

FROM    SYS.DM_DB_PARTITION_STATS p

INNER JOIN
        SYS.TABLES o
    ON p.[object_ID] = o.[object_id]
inner join INFORMATION_SCHEMA.TABLES T
	on T.TABLE_NAME = o.name

WHERE  T.TABLE_SCHEMA = 'ETL_ODS'

GROUP BY o.name

ORDER   BY 2 desc