Get SQL Server schema via a SQL query?(通过 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 架构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:通过 SQL 查询获取 SQL Server 架构?


基础教程推荐
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- 从字符串 TSQL 中获取数字 2021-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- 带更新的 sqlite CTE 2022-01-01