SqlServer:如何获取有关表及其关系的元数据? [英] SqlServer: How to get meta-data about tables and their relationships?

查看:45
本文介绍了SqlServer:如何获取有关表及其关系的元数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有一种方法(我希望相对简单)来获取有关该表及其属性和关系的信息?

I was wondering if there was a way (relatively simple I hope) to get information about the table and its attributes and realtionships?

澄清:我想获取数据库中的所有表并获取整个数据库、表、列数据、索引、唯一约束、表之间的关系等的元模型.

Clarification: I want to grab all tables in the database and get the meta-model for the whole database, tables, column data, indicies, unique constraints, relationships between tables etc.

推荐答案

系统在 sys.tables、sys.columns、sys.indexes 和其他各种表中有数据字典.您可以查询这些表以获取有关数据库结构的元数据.这篇文章有一个我几年前写的逆向工程脚本一个数据库模式.如果你看一看,你会看到一些关于如何使用系统数据字典表的例子.

The system has a data dictionary in sys.tables, sys.columns, sys.indexes and various other tables. You can query these tables to get metadata about the database structure. This posting has a script I wrote a few years ago to reverse engineer a database schema. If you take a look at it you can see some examples of how to use the system data dictionary tables.

这篇关于SqlServer:如何获取有关表及其关系的元数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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