---
title: "Count table size in SQL Server"  
description: "This blog have to described, how to retrieve table size.   Below line of code return all table’s size which associated with current database. Steps ar"  
author: "AVADHESH PATEL"  
published: 2013-02-14  
updated: 2014-09-18  
canonical: https://www.mindstick.com/blog/443/count-table-size-in-sql-server  
category: "database"  
tags: ["database"]  
reading_time: 1 minute  

---

# Count table size in SQL Server

This [blog](https://www.mindstick.com/articles/12705/myths-and-misconception-about-blog) have to described, how to [retrieve](https://www.mindstick.com/forum/34400/how-to-retrieve-form-values-in-controller-action) [table](https://www.mindstick.com/articles/43918/how-to-design-table-using-bootstrap) [size](https://www.mindstick.com/forum/159799/how-can-you-manage-the-size-of-mdf-and-ldf-files).\

Below line of [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) return all table’s size which associated with current [database](https://www.mindstick.com/articles/12226/use-of-database-in-sencha-extjs-and-insert-record-from-user-form-using-ajax). Steps are given below

Use database

Syntax

```
USE <Database Name>e.g.USE MASTER
```

[Copy and paste](https://answers.mindstick.com/qa/95127/how-do-you-copy-and-paste-the-contents-of-a-pdf) below line of code and [execute](https://www.mindstick.com/interview/49/how-can-i-execute-a-php-script-using-command-line) [query](https://www.mindstick.com/blog/202/sub-query-in-sqlserver)

```
USE MASTER SELECT CASE WHEN (GROUPING(sob.name)=1) THEN 'All_Tables'   ELSE ISNULL(sob.name, 'unknown') END AS 'Table Name',   SUM(sys.length) AS 'Size'FROM sysobjects sob, syscolumns sysWHERE sob.xtype='u' AND sys.id=sob.idGROUP BY sob.nameWITH CUBE
```

---

Original Source: https://www.mindstick.com/blog/443/count-table-size-in-sql-server

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
