SQL Server useful scripts

Find out how many records are on your database tables

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]
WHERE index_id <= 1 -- Heap or clustered index only
GROUP BY o.name
HAVING SUM(p.row_count) > 0
ORDER BY 2 desc

Victor Yoalli

This is me.