How can I restore a database backup file (.bak) from SQL Server 2012 into SQL Server 2008 Express?

隐身守侯 提交于 2019-12-03 22:17:48
stormwild

Thanks to Marc and Aaron for providing the answers.

The quick answer is no, it's not possible to restore a backup file from a higher version to a lower version of SQL Server.

A work around would be to generate the scripts to create the database.

You can target the script generation to a lower version.

Please see comments above for more information.

Links:

Why an SQL Server Database from a higher version cannot be restored onto a lower version of SQL Server?

Create Database in SQL Server 2012, Script and Use in 2008?

Jaycob Read

Couple things to add that might be helpful to folks

When scripting large databases using scripting wizard in SSMS it’s really important to check the execution order and be willing to re arrange it manually. Older versions of SSMS had this problem because they (probably) relied on sp_depends that has a bug.

What I’ve found really useful in such cases are tools like ApexSQL Diff that you can use to read database backups and generate scripts that are in correct execution order.

SQL Server database backup restore on lower version

One thing that none of the methods will catch is the thing Aaron mentioned about using functions specific to higher version.

A better option than using the SSMS scripting wizard is to use a similar tool available on Codeplex called SQL Database Migration Wizard - http://sqlazuremw.codeplex.com/releases/view/32334. You want the latest version v4.x to work with SQL Server 2012.

The tool is originally intended to be used for migrating databases between SQL Server and Azure. However the tool works just as well as between SQL Server and SQL Server. The trick is to set SQL Server rather than Azure as the target in the advanced options.

The reason this is a better option than the SSMS scripting wizard is that it uses BCP for the data transfer rather than TSQL and so is much more efficient.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!