{"id":9062,"date":"2024-03-07T06:42:59","date_gmt":"2024-03-07T05:42:59","guid":{"rendered":"https:\/\/expert-only.com\/?p=9062"},"modified":"2024-03-07T13:42:31","modified_gmt":"2024-03-07T12:42:31","slug":"how-to-get-the-size-of-all-tables-in-sql-server","status":"publish","type":"post","link":"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/","title":{"rendered":"How to Get the Size of all Tables in SQL Server ?"},"content":{"rendered":"\n<h4 class=\"wp-block-heading has-text-align-left\"><em>Transact-SQL query to display the list of all table names from a database with size and disk space used on the server.<\/em><\/h4>\n\n\n\n<p>Listing SQL Server table size and disk space can be very convenient specially to analyse the disk usage for each table. Three different ways, but similar are presented here to display SQL Server tables and disk space used by each table. The third solution also shows the number of lines for every table. Check out these SQL Server queries to display the list of SQL Server tables and their size in different ways.<\/p>\n\n\n\n<p>This third query is using different system tables joined together, namely <a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/relational-databases\/system-catalog-views\/sys-tables-transact-sql?view=sql-server-ver15\" target=\"_blank\" rel=\"noreferrer noopener\">sys.tables,<\/a> sys.indexes, sys.partitions, sys.allocation_units and sys.schemas. It displays the schema name, the table name, the row counts and the disk space (total, used and unused space) for each table in a SQL Server database.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 ez-toc-wrap-center counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/#1-sql-server-disk-space-usage-is-a-classical-maintenance-topic\" >1. SQL Server disk space usage is a classical maintenance topic<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/#2-get-the-size-of-all-tables-in-sql-server-using-system-views\" >2. Get the Size of all Tables in SQL Server using system views<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/#3-list-all-sql-server-tables-using-system-tables\" >3. List all SQL Server tables using system tables<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/#4-get-a-list-of-all-sql-tables-from-systables\" >4. Get a list of all SQL tables from sys.tables<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-1-sql-server-disk-space-usage-is-a-classical-maintenance-topic\"><span class=\"ez-toc-section\" id=\"1-sql-server-disk-space-usage-is-a-classical-maintenance-topic\"><\/span>1. SQL Server disk space usage is a classical maintenance topic<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To go further, usually the goal is to check and free up disk space on the server hosting the database. Typically when the server hard drive is getting full, then <a href=\"https:\/\/expert-only.net\/sql-server\/check-last-time-sql-server-table-was-accessed-updated\/\">this query displays the last time a table was&nbsp;accessed or updated<\/a>. It&#8217;s very useful before deletion. For instance, if a table have not been accessed over the last three years, it might not be necessary anymore.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">select \n\tsch.name as SchemaName,\n\ttab.name as TableName,\n\tpar.rows as RowCounts, \n\tsum(alc.total_pages) * 8 as TotalSpace,\n\tsum(alc.used_pages) * 8 as UsedSpace,\n\t(sum(alc.total_pages) - sum(alc.used_pages)) * 8 as UnusedSpace\nFROM sys.tables tab \nINNER JOIN sys.indexes ind \n\tON tab.object_id = ind.object_id \nINNER JOIN sys.partitions par \n\tON ind.object_id = par.object_id \n\tand ind.index_id = par.index_id \nINNER JOIN sys.allocation_units alc \n\tON par.partition_id = alc.container_id \nLEFT OUTER JOIN sys.schemas sch \n\tON tab.schema_id = sch.schema_id \nGROUP BY \n\ttab.name, \n\tsch.name, \n\tpar.rows \nORDER BY 1,2;\n<\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"1000\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/07\/sql-server-query-to-get-size-of-all-tables.jpg\" alt=\"How to Get the Size of all Tables in SQL Server ?\" class=\"wp-image-30585\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/07\/sql-server-query-to-get-size-of-all-tables.jpg 800w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/07\/sql-server-query-to-get-size-of-all-tables-240x300.jpg 240w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/07\/sql-server-query-to-get-size-of-all-tables-768x960.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\"><em>How to Get the Size of all Tables in SQL Server ?<\/em><\/figcaption><\/figure><\/div>\n\n\n<p>Indeed, any database grows, because the log grows, the data grows, the log file grows, the backup file grows, etc. To fix this it&#8217;s mandatory to schedule maintenance scripts to clean the log tables and regularly delete the obsolete data, like for example five years rolling period to keep on line. For compliance legal reasons, depending on the business area, the data might need to be kept and backed-up more years.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-2-get-the-size-of-all-tables-in-sql-server-using-system-views\"><span class=\"ez-toc-section\" id=\"2-get-the-size-of-all-tables-in-sql-server-using-system-views\"><\/span>2. Get the Size of all Tables in SQL Server using system views<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>This approach is to use the data stored in the <strong>information_schema<\/strong> schema about the tables. The Microsoft SQL query uses the information_schema.tables system table to display all the attributes and metadata from the system database. It displays the four columns available in the tables system view: <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>TABLE_CATALOG is the database name.<\/li>\n\n\n\n<li>TABLE_SCHEMA is the schema hosting the table, per default it is database owner (dbo). <\/li>\n\n\n\n<li>TABLE_NAME is the name of the table.<\/li>\n\n\n\n<li>TABLE_TYPE is the table type. <\/li>\n<\/ul>\n\n\n\n<p>Note that we filter the query on the view to display only the base table type. Other table types can also be View.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">SELECT \n\tTABLE_CATALOG, \n\tTABLE_SCHEMA, \n\tTABLE_NAME, \n\tTABLE_TYPE\nFROM\tinformation_schema.tables\nWHERE\ttable_type='base table';<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-3-list-all-sql-server-tables-using-system-tables\"><span class=\"ez-toc-section\" id=\"3-list-all-sql-server-tables-using-system-tables\"><\/span>3. List all SQL Server tables using system tables<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To display SQL Server tables size and disk space, you can also run this last query in SSMS. This one uses the sys.tables system table, it is certainly the source of the system view used in the first query. It shows much more information&#8217;s and metadata. Like for example the creation data, the modification date, and the object_id reusable in other system functions and procedures.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">-- Use the sys.tables system table\nSELECT\t*\nFROM\tsys.tables\nWHERE\t[type_desc] = 'USER_TABLE';\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-4-get-a-list-of-all-sql-tables-from-sys-tables\"><span class=\"ez-toc-section\" id=\"4-get-a-list-of-all-sql-tables-from-systables\"><\/span>4. Get a list of all SQL tables from sys.tables<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The last query uses the sys.tables system table. Certainly the source of the system view used in the first query. It shows a lot more information and metadata, like the creation data, the modification date, and the <strong>object_id<\/strong> which can be reused in other system functions and procedures.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">-- Use the sys.tables system table\nSELECT    *\nFROM    sys.tables\nWHERE    [type_desc] = 'USER_TABLE';\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-about-listing-tables-and-their-attributes-using-t-sql\">About listing tables and their attributes using T-SQL<\/h3>\n\n\n\n<p>In conclusion, this blog article presents several methods for display a list of all the user tables in a SQL Server database and their size. Displaying the size of the tables and the disk space used is useful for analysing the use of each table, which table, which can help to optimise disk space and improve database database performance.<\/p>\n\n\n\n<p>To go further in the SQL Server database maintenance topic, check out this short tutorial on <strong><a href=\"https:\/\/expert-only.com\/en\/dba\/clear-transaction-log\/\">how to empty the transaction log to free up disk space with a Shrink Database script<\/a><\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-embed aligncenter is-type-wp-embed is-provider-sql-and-it-tutorials wp-block-embed-sql-and-it-tutorials\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"CzC2FB1657\"><a href=\"https:\/\/expert-only.com\/en\/dba\/clear-transaction-log\/\">Clear the SQL Server transaction log and fix the 9002 error<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Clear the SQL Server transaction log and fix the 9002 error&#8221; &#8212; SQL and IT Tutorials\" src=\"https:\/\/expert-only.com\/en\/dba\/clear-transaction-log\/embed\/#?secret=UkzS2wEM1M#?secret=CzC2FB1657\" data-secret=\"CzC2FB1657\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>Transact-SQL query to display the list of all table names from a database with size and disk space used on the server. Listing SQL Server table size and disk space can be very convenient specially to analyse the disk <a class=\"mh-excerpt-more\" href=\"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/\" title=\"How to Get the Size of all Tables in SQL Server ?\">&#8230;<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":6158,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[454],"tags":[],"class_list":{"0":"post-9062","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-t-sql"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.7 (Yoast SEO v26.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Get the Size of all Tables in SQL Server ? T-SQL<\/title>\n<meta name=\"description\" content=\"To display all SQL Server tables names, size and disk space used, use these four T-SQL queries in SSMS and also get other metadata.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Get the Size of all Tables in SQL Server ?\" \/>\n<meta property=\"og:description\" content=\"To display all SQL Server tables names, size and disk space used, use these four T-SQL queries in SSMS and also get other metadata.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/\" \/>\n<meta property=\"og:site_name\" content=\"SQL and IT Tutorials\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ExpertOnlyCom\/\" \/>\n<meta property=\"article:published_time\" content=\"2024-03-07T05:42:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-07T12:42:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/computer-hard-drive-7CCA596F23D_1920x1080.jpeg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Expert-Only\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@expert_only\" \/>\n<meta name=\"twitter:site\" content=\"@expert_only\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Expert-Only\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/\"},\"author\":{\"name\":\"Expert-Only\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\"},\"headline\":\"How to Get the Size of all Tables in SQL Server ?\",\"datePublished\":\"2024-03-07T05:42:59+00:00\",\"dateModified\":\"2024-03-07T12:42:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/\"},\"wordCount\":679,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/computer-hard-drive-7CCA596F23D_1920x1080.jpeg\",\"articleSection\":[\"T-SQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/\",\"url\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/\",\"name\":\"How to Get the Size of all Tables in SQL Server ? T-SQL\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/computer-hard-drive-7CCA596F23D_1920x1080.jpeg\",\"datePublished\":\"2024-03-07T05:42:59+00:00\",\"dateModified\":\"2024-03-07T12:42:31+00:00\",\"description\":\"To display all SQL Server tables names, size and disk space used, use these four T-SQL queries in SSMS and also get other metadata.\",\"breadcrumb\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/#primaryimage\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/computer-hard-drive-7CCA596F23D_1920x1080.jpeg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/computer-hard-drive-7CCA596F23D_1920x1080.jpeg\",\"width\":1920,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"en\",\"item\":\"https:\/\/expert-only.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Get the Size of all Tables in SQL Server ?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/expert-only.com\/en\/#website\",\"url\":\"https:\/\/expert-only.com\/en\/\",\"name\":\"SQL and IT Tutorials\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/expert-only.com\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/expert-only.com\/en\/#organization\",\"name\":\"Expert-Only\",\"url\":\"https:\/\/expert-only.com\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg\",\"width\":381,\"height\":174,\"caption\":\"Expert-Only\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/ExpertOnlyCom\/\",\"https:\/\/x.com\/expert_only\",\"https:\/\/www.youtube.com\/channel\/UCMS5sR_FwAetB0FmciNvUaA\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\",\"name\":\"Expert-Only\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g\",\"caption\":\"Expert-Only\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Get the Size of all Tables in SQL Server ? T-SQL","description":"To display all SQL Server tables names, size and disk space used, use these four T-SQL queries in SSMS and also get other metadata.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/","og_locale":"en_US","og_type":"article","og_title":"How to Get the Size of all Tables in SQL Server ?","og_description":"To display all SQL Server tables names, size and disk space used, use these four T-SQL queries in SSMS and also get other metadata.","og_url":"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/","og_site_name":"SQL and IT Tutorials","article_publisher":"https:\/\/www.facebook.com\/ExpertOnlyCom\/","article_published_time":"2024-03-07T05:42:59+00:00","article_modified_time":"2024-03-07T12:42:31+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/computer-hard-drive-7CCA596F23D_1920x1080.jpeg","type":"image\/jpeg"}],"author":"Expert-Only","twitter_card":"summary_large_image","twitter_creator":"@expert_only","twitter_site":"@expert_only","twitter_misc":{"Written by":"Expert-Only","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/#article","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/"},"author":{"name":"Expert-Only","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef"},"headline":"How to Get the Size of all Tables in SQL Server ?","datePublished":"2024-03-07T05:42:59+00:00","dateModified":"2024-03-07T12:42:31+00:00","mainEntityOfPage":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/"},"wordCount":679,"commentCount":0,"publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"image":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/computer-hard-drive-7CCA596F23D_1920x1080.jpeg","articleSection":["T-SQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/","url":"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/","name":"How to Get the Size of all Tables in SQL Server ? T-SQL","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/#primaryimage"},"image":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/computer-hard-drive-7CCA596F23D_1920x1080.jpeg","datePublished":"2024-03-07T05:42:59+00:00","dateModified":"2024-03-07T12:42:31+00:00","description":"To display all SQL Server tables names, size and disk space used, use these four T-SQL queries in SSMS and also get other metadata.","breadcrumb":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/#primaryimage","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/computer-hard-drive-7CCA596F23D_1920x1080.jpeg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/computer-hard-drive-7CCA596F23D_1920x1080.jpeg","width":1920,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-get-the-size-of-all-tables-in-sql-server\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"en","item":"https:\/\/expert-only.com\/en\/"},{"@type":"ListItem","position":2,"name":"How to Get the Size of all Tables in SQL Server ?"}]},{"@type":"WebSite","@id":"https:\/\/expert-only.com\/en\/#website","url":"https:\/\/expert-only.com\/en\/","name":"SQL and IT Tutorials","description":"","publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/expert-only.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/expert-only.com\/en\/#organization","name":"Expert-Only","url":"https:\/\/expert-only.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg","width":381,"height":174,"caption":"Expert-Only"},"image":{"@id":"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/ExpertOnlyCom\/","https:\/\/x.com\/expert_only","https:\/\/www.youtube.com\/channel\/UCMS5sR_FwAetB0FmciNvUaA"]},{"@type":"Person","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef","name":"Expert-Only","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g","caption":"Expert-Only"}}]}},"_links":{"self":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/9062","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/comments?post=9062"}],"version-history":[{"count":2,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/9062\/revisions"}],"predecessor-version":[{"id":30592,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/9062\/revisions\/30592"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media\/6158"}],"wp:attachment":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media?parent=9062"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/categories?post=9062"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/tags?post=9062"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}