且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将数据库从 SQL Server 2012 降级到 2008

更新时间:2023-01-21 16:52:32

不能转换 SQL Server 2012 数据库文件到 SQL Server 2008 数据库文件.降级是不可能的.数据库文件的兼容性仅适用于从旧版本到新版本,而不是相反.实际上,您可以转换一个 SQL Server 2008 数据库文件到 SQL Server 2012 数据库文件.

使用集成的 SQL Server 工具:

  1. 右键单击数据库.
  2. 选择TasksGenerate Scripts.

按照向导,在 Advanced Scripting Options 的最后,单击Advanced"按钮,选择要为其生成脚本的 SQL Server 版本,使用选项 服务器版本脚本.此外,您可以生成脚本以导出对象和/或数据的架构,选择选项 Types of data to script,如下面的屏幕截图所示:>

流程生成(架构和数据)所需的时间当然取决于您要导出的数据量.正如@Arun 建议的那样,更详细地查看该过程 此处,使用分步说明.

I want to downgrade the database to SQL Server 2008 Enterprise edition. I know there is no direct option. I tried to backup on 2012 and then restore on 2008. Not working.Any Idea on how to completely transfer database ?

You cannot convert a SQL Server 2012 database file to a SQL Server 2008 database file. The downgrade is not possible. The compatibility of database files is available only from an old version to a newer one, not the opposite. Indeed, you can convert a SQL Server 2008 database file to SQL Server 2012 database file.

Use the integrated SQL Server tools:

  1. Right click on the database.
  2. Select Tasks and Generate Scripts.

Following the wizard, at the end of it in the Advanced Scripting Options clicking the "Advanced" button, select the SQL Server version for which you want to generate the scripts, using the option Script for Server Version. Moreover, you would be able to generate the scripts to export the schema of your objects and/or the data, selecting the option Types of data to script, as you can see in the screenshot below:

The time needed for the process to generate both (schema and data) will depend on the amount of data you want to export, of course. As @Arun suggested, have a look at the process in more detail here, using step by step instructions.