在 SQL Server 2012 中创建数据库,在 2008 中编写脚本并使用? [英] Create Database in SQL Server 2012, Script and Use in 2008?

查看:26
本文介绍了在 SQL Server 2012 中创建数据库,在 2008 中编写脚本并使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我使用 2012 创建一个数据库并工作并将该信息添加到其中,如果我在此之后编写数据库脚本,我是否能够在 2008 年运行该脚本并且一切正常?

解决方案

脚本?是的.好吧,让我改写一下:这取决于.只要您的对象不使用任何 2012 特定的功能,您就可以使用 Management Studio 或各种 3rd 方工具(我在这里写了一些关于一些选项的博客).许多工具还提供选项(或配套工具)来编写数据脚本.

问题是在 SQL Server 2012 中没有一种非常简单的方法来识别您可能使用 2012 特定功能的所有位置.例如,我不知道有什么工具可以检查您的数据库并指出您正在使用 FORMAT() 函数,该函数在 SQL Server 2008 或 2008 R2 中不可用.>

其他复制数据库的方法 - 备份/恢复、附加/分离、镜像/日志传送等将不起作用.你可以上升(从 2005、2008 或 2008 R2)到 2012,但你不能倒退.

所以总的来说,我同意约翰的观点.在版本 <= 部署版本上开发要安全得多.为什么要在 2012 年开发部署到 2008 年?对我来说似乎很冒险.

If I create a database using 2012 and work and add that info to it, if I were to script the database after, would I be able to run the script in 2008 and have everything work A.O.K?

解决方案

A script? Yes. Well, let me rephrase: it depends. As long as your objects don't use any 2012-specific features, you will be able to script out the schema using Management Studio or a variety of 3rd party tools (I blogged about some options here). Many of the tools also offer options (or companion tools) to also script the data.

The problem is there isn't a very easy way in SQL Server 2012 to identify all of the places where you might be using 2012-specific features. For example, I don't know of a tool that will inspect your database and point out that you are using the FORMAT() function, which is not available in SQL Server 2008 or 2008 R2.

Other means of copying the database over - backup/restore, attach/detach, mirroring/log shipping etc. will not work. You can go up (from 2005, 2008 or 2008 R2) to 2012, but you can't go backwards.

So in general I agree with John. Much safer to develop on a version <= deployment version. Why would you want to develop on 2012 to deploy to 2008? Seems quite risky to me.

这篇关于在 SQL Server 2012 中创建数据库,在 2008 中编写脚本并使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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