有没有一种快速的方法来报告SQL Server 2005中的数据库元数据? [英] Is there a quick way to report database metadata in SQL Server 2005?

查看:76
本文介绍了有没有一种快速的方法来报告SQL Server 2005中的数据库元数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在SQL Server 2005中是否有任何系统存储的proc来报告数据库本身的统计信息和元数据?

Are there any system stored procs to report the stats and metadata of a database itself in SQL Server 2005?

我需要的是一种快速输出列表的方法表的数量,每个表的大小,每个表中的行数等等。为单个表和元数据存储的proc也将很有用。

What I need is a quick way to output a list of tables, the size of each table, the number of rows in each table and so on. Stored procs for individual tables and metadata would also be useful.

建议多加注意。

推荐答案

是的,数据字典表将允许您执行此操作。数据字典中的主表为 sys.objects sys.columns sys.indexes sys.foreign_keys sys.sql_modules 。有关使用系统数据字典将数据库反向工程为SQL脚本的各种查询的示例,请查看

Yes, the data dictionary tables will let you do this. The main tables in the data dictionary are sys.objects, sys.columns, sys.indexes, sys.foreign_keys and sys.sql_modules. For an example of a variety of queries that use the system data dictionary to reverse-engineer a database to an SQL script, take a look at this stackoverflow posting.

从数据字典中获取空间使用量有些复杂,但是 sp_spaceused 将针对单个表执行此操作。您可以使用 sp_msforeachtable 进行包装一组表并获取所有表的报告。

Getting space usage is a bit more convoluted to do from the data dictionarybut sp_spaceused will do it for a single table. You can wrap this with sp_msforeachtable to iterate over a set of tables and get the report for all of the tables.

这篇关于有没有一种快速的方法来报告SQL Server 2005中的数据库元数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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