How to get the records count per table from SQL Server Database?


I have started working on Data Migration work. So, started knowing more on SQL Server, Tables, Database Sizes and etc..

Today, I found the way to know the Records count per table and size of each table in the Database.
Here are the steps to follow for getting the details.

1) Logon to SQL Server Management Studio
2) Right-click on the database which you want to know the details.
3) Select Reports -> Standard Reports -> Disk Usage by Table.

4) A report will be loaded in a new tab. This might take a couple of seconds depending on the size of the database.

5) You can export the report to Excel, PDF and Word and perform your analysis on it.

Note : This procedure can be applied for any database. As CRM Database is my favorite, I have taken that as a sample.

Hope this helps.

Happy Querying.


How to check the database size in SQL Server?

Today, I got know the size of the database. But unfortunately I could not get the correct database size on the file system until I take the back up.
Select the database, right click and click on properties.


In the above image, the size shown 460.81 MB is sum of Data and Log files. It doesn’t mean that real size of the database would be the same.
I have taken the back up of the database and on the file system the size mentioned was 262 MB.

Space Available 90.03 MB is the space that is still available to fill up. Once this space is utilized then SQL Server will allocates new Data space and Log space as per the growth rate set.
Use the following query to see the size of Log files and data files individually.

SELECT DB_NAME(database_id) AS DatabaseName,
Name AS Logical_Name,
Physical_Name, (size*8)/1024 SizeMB
FROM sys.master_files
WHERE DB_NAME(database_id) = 'DB_NAME'


351 + 109 = 460 MB.
Hope this helps.