Query table occupy space size

Source: Internet
Author: User


DECLARE

@sql as NVARCHAR(+),

@schmeaname as sysname,

@tablename as sysname;

DECLARE C CURSOR fast_forward for

SELECT table_schema,table_name

From information_schema. Tables

WHERE table_type = ' BASE table '

OPEN C

FETCH NEXT from C to @schmeaname,@tablename;

While @ @FETCH_STATUS = 0

BEGIN

SET @sql =

n ' EXEC sp_spaceused n ' '

+ QUOTENAME(@schmeaname)  + N '. '

+ QUOTENAME(@tablename) +N ";";

EXEC(@sql);

FETCH NEXT from C to @schmeaname,@tablename ;

END

CLOSE C;

deallocate C;


650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "border=" 0 "style=" Background:url ("/e/u261/ Lang/zh-cn/images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>


This article is from the "Data Domain" blog, so be sure to keep this source http://charlist.blog.51cto.com/1616209/1697478

Query table occupy space size

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.