创建与2008兼容的SQL Server 2012数据库

Bog*_* M. 4 sql-server sql-server-2008 sql-server-2012

有没有办法使用SQL Server 2012创建数据库并能够将其传递给SQL Server 2008?

mar*_*c_s 14

在备份2012年数据库并将其恢复到2008年?

不,你不能这样做

没有方法,没有方法,没有技巧,没有黑客,没有解决方法 - 它只是无法完成.

您需要使用.sql结构和数据的脚本从任何较新的SQL Server版本和旧版本移动.SQL Server备份文件(*.bak)和实际数据库文件(*.mdf,*.ndf)从未向后兼容.

并且揭穿一个神话:设置兼容性级别限制可用的功能(如数据类型等) - 但它不会使*.bak备份或*.mdf数据文件与旧版本兼容.


Sam*_*Sam 10

我刚刚将数据库从2012年转移到2008 R2.

(这需要两个都在线,你需要设置新数据库才能访问它,我在办公室环境中这样做,2012年数据库用于创建C#应用程序,但它运行的数据库是2008年,您可以在本地执行此操作我想,然后在执行以下操作后将数据从2008备份到.bak文件,但我没有测试过)

我将表的结构导出为SQL by;

-> Right clicking the database
-> Tasks
-> Generate scripts
-> Choose Objects (Script entire database and all database objects) 
-> Save to New Query Window (Click Advanced and under "Script for server version" choose your version) 
-> Click Next and Next and it should generate SQL to new window. 
-> I removed everything above "GO, ALTER DATABASE" 
-> Create the new database on the 2008 Server using the same name and run the above SQL to make the tables.
Run Code Online (Sandbox Code Playgroud)

要做表数据:

-> In the 2012 database right click the database and click tasks
-> Export data
-> Choose the source
-> Next 
-> Choose the destination
-> Copy data from one or more tables
-> Next
-> Select the tables
-> Next
-> Run Immediately
Run Code Online (Sandbox Code Playgroud)

希望这有效/帮助其他人,因为我花了一段时间才弄明白.