通过SQL查询获取SQL Server架构? [英] Get SQL Server schema via a SQL query?

查看:142
本文介绍了通过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 ,一个API来获得在元数据在SQL Server中。

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

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

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