通过MySQL和SQL Server上的查询生成表DDL [英] Generate table DDL via query on MySQL and SQL Server

查看:491
本文介绍了通过MySQL和SQL Server上的查询生成表DDL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有通过查询,使用Ms或我的SQL服务器提取表DDL信息的简单方法? (最好是两个?)



例如,使用MySQL Administrator / Navicat for MySql,有一个DDL函数,它生成create table foo 。)script。



有任何方法可以从查询本身获取这些信息,例如:

 从foo中选择DDL,其中table_name ='bar'; 

任何有创建表格栏p>

如果没有 - 任何建议?

解决方案

SHOW CREATE TABLE 为您提供表的DDL。


Is there an easy way to extract table DDL information, via a query, using either Ms or My SQL server? (preferably both?)

For example, using MySQL Administrator / Navicat for MySql, there is a "DDL" function, which generates the "create table foo (....)" script.

Is there any way to get this information from a query itself, such as:

Select DDL from foo where table_name='bar';

Any have the "Create table bar (.....)" returned to me?

If not - any suggestions?

解决方案

it's mysql-specific, but SHOW CREATE TABLE gives you the DDL for a table.

这篇关于通过MySQL和SQL Server上的查询生成表DDL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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