通过 SQL 查询获取 SQL Server 架构?

Get SQL Server schema via a SQL query?(通过 SQL 查询获取 SQL Server 架构?)
本文介绍了通过 SQL 查询获取 SQL Server 架构?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从一个糟糕的开发人员那里继承了一个笨重且没有文档的网站,我正在尝试查看数据库架构.不幸的是,网络主机是我处理过的最糟糕的,并且没有用于查看数据库架构甚至导出表的控制面板功能.

I've inherited a clunky and horribly un-documented site from a bad developer and am trying to get a look at the database schema. Unfortunately the web host is the worst I've ever dealt with and has no control panel capability for viewing the db schema or even exporting tables.

有什么方法可以让我通过 SQL 查询查看架构(这将使用 ASP + SQL Server)?我的最终目标是查看存在哪些表,可能获得重要表的 SQL 转储,然后以正确的方式重新创建整个事物.

Is there any way that I can get a look at the schema via a SQL query (this would be with ASP + SQL Server)? My end goal here is to see what tables exist, possibly get a SQL dump of the vital tables, and then recreate the whole thing the right way.

推荐答案

INFORMATION_SCHEMA 架构是一个很好的起点:

The INFORMATION_SCHEMA schema is a good place to start:

SELECT * FROM INFORMATION_SCHEMA.TABLES
SELECT * FROM INFORMATION_SCHEMA.VIEWS

...等等.

您可能还想看看使用 SMO,用于获取 SQL Server 中的元数据的 API.

You might also want to have a look at using SMO, an API to get at the metadata in SQL Server.

这篇关于通过 SQL 查询获取 SQL Server 架构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Execute complex raw SQL query in EF6(在EF6中执行复杂的原始SQL查询)
SSIS: Model design issue causing duplications - can two fact tables be connected?(SSIS:模型设计问题导致重复-两个事实表可以连接吗?)
SQL Server Graph Database - shortest path using multiple edge types(SQL Server图形数据库-使用多种边类型的最短路径)
Invalid column name when using EF Core filtered includes(使用EF核心过滤包括时无效的列名)
How should make faster SQL Server filtering procedure with many parameters(如何让多参数的SQL Server过滤程序更快)
How can I generate an entity–relationship (ER) diagram of a database using Microsoft SQL Server Management Studio?(如何使用Microsoft SQL Server Management Studio生成数据库的实体关系(ER)图?)