SQL Server 2008 自动生成更改脚本遗留问题

发布于 2024-07-11 17:29:37 字数 503 浏览 8 评论 0原文

我们在 SQL Server Management Studio (SSMS) 中启用“工具 ==> 选项 ==> 设计器 ==> 表和数据库设计器 ==> 自动生成更改脚本”。 更改数据库架构时,我们保存脚本,并且由于我们在运行应用程序的所有计算机上安装了数据库迁移工具,我们可以在下一个软件版本更新期间同步架构。

我们最近将我们的开发副本和一些生产服务器切换到 SQL Server 2008。但是,我们仍然有几十个 SQL Server 2005 在野外运行我们的软件。 我们暂时不打算升级这些。

问题很简单。 SSMS 生成的脚本并不总是适用于 SQL Server 2005。SMSS 正在向命令添加额外的元数据(例如,关于锁升级)。 为了使我们的脚本使用 2005,我们必须手动删除额外的信息,否则脚本将无法运行。

有什么方法可以配置 SSMS 来生成与 SQL Server 2005 兼容的脚本吗? 是否有工具可以自动删除额外的 SQL 或者至少让我们知道哪些文件有问题?

We enable "Tools ==> Options ==> Designers ==> Table and Database Designers ==> Auto Generate Change Scripts" in our SQL Server Management Studio (SSMS). When changing our database schema, we save the script and, thanks to DB migration tools we've got installed on all the machines running our applications, we can synchronize the schema during the next software version update.

We recently switched our development copies and some production servers to SQL Server 2008. However, we still do have a few dozen SQL Server 2005 running our software in the wild. We're not planning on upgrading these for a little while.

The problem is simple. The scripts generated by SSMS simply don't always work with SQL Server 2005. SMSS is adding extra metadata to the commands (concerning lock escalation, for example). To make our scripts with 2005, we have to manually remove the extra information, otherwise the scripts don't run.

Is there any way to configure SSMS to generate scripts that are compatible with SQL Server 2005? Are there tools around that would get rid of the extra SQL automatically or at least let us know which files are problematic?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

你是暖光i 2024-07-18 17:29:37

在 SQL Server Management Studio 2008 中,转到工具 -> 选项-> SQL Server 对象资源管理器 -> 脚本并选择“服务器版本脚本”并将其更改为 SQL Server 2005。

In SQL Server management studio 2008 goto Tools -> Options -> SQL Server Object Explorer -> Scripting and Select "Script for server version" and change it to SQL Server 2005.

三生池水覆流年 2024-07-18 17:29:37

更改选项的推荐解决方案似乎是 corerct,但它仍然在我的数据库上生成 ALTER TABLE SET (LOCK_ESCALATION = TABLE)(我什至设置了兼容模式 90)

The recommended solution to change the options appears to be corerct however it still generates ALTER TABLE SET (LOCK_ESCALATION = TABLE) on my database (I even put in compatibility mode 90)

半寸时光 2024-07-18 17:29:37

我还没有使用过 2008 Management Studio,但在之前的每个版本中,您都可以在某个选项中将脚本设置为特定版本的 SQL Server。

出于类似的原因,我将 2005 Management Studio 设置为生成 2000 个兼容脚本。

I've not used the 2008 management studio yet but in every previous version you have been able to set the scripting to a specific version of SQL Server in the options somewhere.

I have the 2005 management studio set to generate 2000 compatible scripts for similar reasons.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文