DB中所有表的索引大小 [英] Size of index of all the tables in a DB

查看:61
本文介绍了DB中所有表的索引大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在单个查询中查找数据库中所有表的名称,索引的名称,索引的大小以及该索引中的列。我找到了所有这些的单独查询。但我需要使用单个查询找到它们。我怎么做?

I need to find names of all the tables in a DB, name of the indexes present, size of the index, and the columns in that index in a single query. I''ve got separate queries for finding all these. But i need to find them using a single query. how do i do this?

推荐答案

你好





Hello


select t.name as Tbl_Name ,i.type_desc as Indextype ,c.name as column_name ,ty.name as datatypes,c.max_length as ColumnSize from  sys.tables t
JOIn sys.indexes i
ON t.object_id =	i.object_id 
JOIN sys.index_columns ic
ON ic.object_id =	i.object_id 
and	i.index_id	=	ic.index_id 
JOIN sys.columns c
ON	c.object_id		=	ic.object_id 
AND	c.column_id		=	ic.column_id 
JOIN sys.types  Ty
On c.user_type_id	=	ty.user_type_id





请检查它会对你有所帮助。



投票如果你清楚。



Pls check it will help you.

Vote if u clear.


这篇关于DB中所有表的索引大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆