从命令行生成 SQL 服务器脚本? [英] Generate SQL server scripts from command line?

查看:69
本文介绍了从命令行生成 SQL 服务器脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Microsoft SQL Server Management Studio 2008 中,任务菜单下有一个生成脚本..."选项.我只是想知道这个工具是否可以从命令行以某种方式使用?

In Microsoft SQL Server Management Studio 2008 there is a "Generate scripts..." option under the Tasks menu. I'm just wondering if this tool is available from the command line somehow?

它看起来类似于 SQL Server 2005 可用的 sqlpubwiz.exe 命令行工具,但我在 SQL 2008 安装的任何地方都找不到这个可执行文件.

It looks similar to the sqlpubwiz.exe command line tool that was available for SQL Server 2005, but I can't find this executable anywhere in the SQL 2008 installation.

推荐答案

Management Studio 的脚本生成选项只是 SMO 脚本功能.通过在各种 SMO 类型上使用 Script() 方法获得简单的脚本.更复杂的脚本由专门的 创建Scripter 类.

The script generating options of Management Studio are just a wrapper around the SMO scripting capabilities. Simple scripts are obtained by using the Script() method on various SMO types. More complex scripts are created by the specialized Scripter class.

可以使用 SMO 库轻松创建命令行工具.

Command line tools can be easily created by using the SMO libraries.

这篇关于从命令行生成 SQL 服务器脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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