问题描述
我从一个糟糕的开发人员那里继承了一个笨重且没有文档的网站,我正在尝试查看数据库架构.不幸的是,网络主机是我处理过的最糟糕的,并且没有用于查看数据库架构甚至导出表的控制面板功能.
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 架构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!