创建与 2008 兼容的 SQL Server 2012 数据库 [英] Create SQL Server 2012 database compatible for 2008
问题描述
有没有办法使用 SQL Server 2012 创建数据库并能够将其传递给 SQL Server 2008?
Is there a way to create a database with SQL Server 2012 and to be able to pass it to SQL Server 2008?
推荐答案
我刚刚将一个数据库从 2012 转移到 2008 R2.
I just transferred a database from 2012 to 2008 R2.
(这需要在线并且您必须设置具有访问权限的新数据库,我在办公环境中执行此操作,其中使用 2012 数据库创建 C# 应用程序但它运行的数据库是对于 2008 年,我想您可以在本地执行此操作,然后在您执行以下操作后将 2008 年的数据备份到 .bak 文件,但我还没有测试过)
(this requires both to be online and you to have setup the new database with permission to access it, I did this in an office enviroment where the 2012 database was used to create a C# application but the database it was running on was for 2008, you could do this locally I suppose and then backup the data from 2008 to a .bak file once you did the below but I haven't tested that)
我将表的结构导出为 SQL by;
I exported the structure of the tables as 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.
<小时>
做表数据:
To do the table data:
-> 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
希望这有效/可以帮助其他人,因为我花了一段时间才弄明白.
Hopefully this works / helps someone else out as it took me a while to figure out.
这篇关于创建与 2008 兼容的 SQL Server 2012 数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!