简体   繁体   English

更改SQL Server数据库版本

[英]Change SQL Server database version

I have a SQL Server 2008 version database (version number 655). 我有一个SQL Server 2008版本数据库(版本号655)。 If I try to create for attach it to a SQL Server 2005 or SQL Server 2000, I get an error: 如果我尝试创建将其附加到SQL Server 2005或SQL Server 2000,我收到一个错误:

This database is version 655. This server is compatible with version 612 or previous 此数据库的版本为655.此服务器与版本612或之前的版本兼容

Of course I can attach the database to SQL Server 2008 without errors. 当然,我可以将数据库附加到SQL Server 2008而不会出现错误。 I know I can generate SQL commands for the structure, but there is a lot of data also in many tables. 我知道我可以为结构生成SQL命令,但许多表中也有很多数据。

If I can change the internal database version (the compatibility level is now set to SQL Server 2000), the attach process in any server version will work, as this process updates the version automatically. 如果我可以更改内部数据库版本(兼容级别现在设置为SQL Server 2000),则任何服务器版本中的附加进程都将起作用,因为此进程会自动更新版本。

Any suggestions? 有什么建议么?

EDIT: I just realized that if the update of the version number is automatic, there will be no way of doing a version change. 编辑:我刚刚意识到,如果版本号的更新是自动的,那么将无法进行版本更改。 So, I reformulate the question: 所以,我重新提出了这个问题:

Do you know any tool that generate a "package" with data and structure that is compatible for SQL Server versions from 2000 to 2008? 你知道任何生成“包”的工具,其数据和结构与2000年到2008年的SQL Server版本兼容吗? A tool or a Script, perhaps. 也许是工具或脚本。

Thanks again. 再次感谢。

Thanks in advance. 提前致谢。

You cannot under any circumstances attach a database from a SQL Server 2008 server to a previous version like SQL Server 2005. 在任何情况下,您都不能将数据库从SQL Server 2008服务器附加到SQL Server 2005之类的先前版本。

There is no way to achieve this - there's no "conversion" tool to change the database version or anything. 没有办法实现这一点 - 没有“转换”工具来更改数据库版本或任何东西。

If you need to support SQL Server 2005, you have to have a SQL Server 2005 server at hand (maybe in a VM or something). 如果您需要支持SQL Server 2005,则必须拥有一台SQL Server 2005服务器(可能在VM或其他东西中)。 Or then you need to use tools like Red Gate's SQL Compare and SQL Data Compare to synchronize changes between your SQL Server 2008 and your other SQL Server 2005 database. 或者您需要使用Red Gate的SQL CompareSQL Data Compare等工具来同步SQL Server 2008和其他SQL Server 2005数据库之间的更改。

No, sorry. 不,对不起 Recreate your database on the outdated SQL Server. 在过时的SQL Server上重新创建数据库。 Like most software, SQL Server only supports UPGRADES, not downgrades. 与大多数软件一样,SQL Server仅支持UPGRADES,而不支持降级。

It's not possible. 这是不可能的。 You cannot attach/restore an SQL Server database to an earlier version of SQL Server I'm afraid. 您不能将SQL Server数据库附加/还原到早期版本的SQL Server。 You have to do an export/import. 你必须做出口/进口。

不,你不能将sql 2008降级为sql 2005

¿Do you know any tool that generate a "package" with data and structure that is compatible for SQL Server versions from 2000 to 2008? ¿您知道任何生成“包”的工具,其数据和结构与2000年到2008年的SQL Server版本兼容吗? A tool or a Script, perhaps. 也许是工具或脚本。

Old post. 老帖子。 I am adding 2 suggestions for the sake of futures readers. 我为期货读者添加了2条建议。 New T-SQL features (syntax) cannot be back-ported (of course), but for simple scenarios (where every table has a primary key) you can temporarily set up and use transactional replication. 新的T-SQL功能(语法)不能反向移植(当然),但对于简单的场景(每个表都有主键),您可以临时设置和使用事务复制。 You can also write a script that will BCP OUT every table's data (I suggest /native mode), perhaps using sp_MSForEachTable for that BCP command - this is essentially what replication's snapshot process does. 您还可以编写一个脚本来BCP OUT每个表的数据(我建议/本机模式),也许使用sp_MSForEachTable作为该BCP命令 - 这实际上是复制的快照过程所做的。

i have same problem but there is a way for achieving to this issue: 我有同样的问题,但有一种方法来实现这个问题:

  • attach a Database from Server 2008(or higher) to a SQL Server 2005(or 2000) 将数据库从Server 2008(或更高版本)附加到SQL Server 2005(或2000)

from a higher SQL version generate a Script (right click on your database > Task > Generate scripts ) then on SQL lower version create a raw database (by the same name) and run your script. 从较高的SQL版本生成脚本(右键单击您的数据库>任务>生成脚本)然后在SQL较低版本上创建一个原始数据库(使用相同的名称)并运行您的脚本。

  • you have option to generate all data(or just create tables - store procdure-user-functions , ...) and then imported to SQL lower version database 你有选择生成所有数据(或只是创建表 - 存储procdure-user-functions,...)然后导入到SQL低版本数据库

I test this solution for SQL 2012 to SQL 2005. Except the new functions that developed for SQL higher version Every Schema & data generate to .sql file and then imported to lower SQL 我为SQL 2012测试此解决方案到SQL 2005.除了为SQL开发的新函数更高版本每个架构和数据生成到.sql文件然后导入到低级SQL

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM