我如何可以自动"生成脚本"在SQL Server Management Studio 2008的任务是什么? [英] How can I automate the "generate scripts" task in SQL Server Management Studio 2008?

查看:342
本文介绍了我如何可以自动"生成脚本"在SQL Server Management Studio 2008的任务是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在SQL Server Management Studio 2008的自动化脚本生成。

I'd like to automate the script generation in SQL Server Management Studio 2008.

现在我要做的就是:


  • 右键点击我的数据库,任务,生成脚本......

  • 手动选择我需要的,并击中全部选择选择对象选项卡上的所有出口选项

  • 选择输出文件夹

  • 最后点击完成按钮

有没有办法来自动执行此任务?

Is there a way to automate this task?

编辑:我要生成的创建脚本,而不是改变剧本

Edit : I want to generate creation scripts, not change scripts.

推荐答案

什么是布莱恩从Visual Studio 2008 SP1团队套件一提的是数据库发布向导1.4版本。它的安装与SQL Server 2008(也许只有专业?)到\\ Program Files文件\\ Microsoft SQL Server的\\ 90 \\ TOOLS \\发布\\ 1.4。从服务器资源管理器VS调用简单地调用此。您可以通过命令行实现同样的功能,例如:

What Brann is mentioning from the Visual Studio 2008 SP1 Team Suite is version 1.4 of the Database Publishing Wizard. It's installed with sql server 2008 (maybe only professional?) to \Program Files\Microsoft SQL Server\90\Tools\Publishing\1.4. The VS call from server explorer is simply calling this. You can achieve the same functionality via the command line like:

sqlpubwiz help script

我不知道是否V1.4具有V1.1做(用户转换为,不按正确的顺序创建的约束作用)相同的烦恼,但它不是一个解决方案,我,因为它不 ŧ脚本反对像任务 - 不同的文件>在生成脚本SSMS选项做。我目前使用Scriptio的修改版本(使用MS SMO API)作为一种改进更换为数据库发布向导(sqlpubwiz.exe)。这不是目前的命令行脚本的,我可能会在未来加入了贡献。

I don't know if v1.4 has the same troubles that v1.1 did (users are converted to roles, constraints are not created in the right order), but it is not a solution for me because it doesn't script objects to different files like the Tasks->Generate Scripts option in SSMS does. I'm currently using a modified version of Scriptio (uses the MS SMO API) to act as an improved replacement for the database publishing wizard (sqlpubwiz.exe). It's not currently scriptable from the command line, I might add that contribution in the future.

Scriptio最初发布于比尔格拉齐亚诺的博客,但其后已比尔他人发布codePLEX和更新。阅读讨论,看看如何编译与SQL Server 2008中使用。

Scriptio was originally posted on Bill Graziano's blog, but has subsequently been released to CodePlex by Bill and updated by others. Read the discussion to see how to compile for use with SQL Server 2008.

HTTP://scriptio.$c$cplex.com/

编辑:我已经使用展鹏的SQL比较产品要做到这一点,因为开始。这是一个非常好的替代所有SQL发布向导应有的水平。您可以选择一个数据库,备份或快照作为源,并且文件夹作为输出位置,它很好地转储一切都变成文件夹结构。这恰好是相同的格式,他们的其它产品,SQL源代码管理,使用。

I've since started using RedGate's SQL Compare product to do this. It's a very nice replacement for all that sql publishing wizard should have been. You choose a database, backup, or snapshot as the source, and a folder as the output location and it dumps everything nicely into a folder structure. It happens to be the same format that their other product, SQL Source Control, uses.

这篇关于我如何可以自动"生成脚本"在SQL Server Management Studio 2008的任务是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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