简体   繁体   English

我无法使用SQL Server 2008附加数据库

[英]I can't attach a database using sql server 2008

I created a database on SQL server 2012 on Windows 7 and I want to work with this database on Windows XP which has a sql server 2008 installed. 我在Windows 7的SQL Server 2012上创建了一个数据库,并且我想在安装了sql server 2008的Windows XP上使用该数据库。 The problem is when I want to attach the database in sql server 2008 it gives me this error message : 问题是,当我想在sql server 2008中附加数据库时,它给出了以下错误消息:

TITRE : Microsoft SQL Server Management Studio
------------------------------

Échec de Attach database pour Serveur « MAC-BOOK-AIR\SQLEXPRESS ».  (Microsoft.SqlServer.Smo)

Pour obtenir de l'aide, cliquez sur : http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.0.1600.22+((SQL_PreRelease).080709-1414+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476

------------------------------
INFORMATIONS SUPPLÉMENTAIRES :

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

------------------------------

The database 'GESTION_STAGE' cannot be opened because it is version 706. This server supports version 612 and earlier. A downgrade path is not supported.
Could not open new database 'GESTION_STAGE'. CREATE DATABASE is aborted. (Microsoft SQL Server, Erreur : 948)

Pour obtenir de l'aide, cliquez sur : http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=948&LinkId=20476

Is there any possibility to attach the database without installing an earlier version of sql server ? 是否有可能在不安装SQL Server早期版本的情况下附加数据库? Because I can't install sql server 2012 in Windows XP. 因为我无法在Windows XP中安装sql server 2012。

No. 没有。

You can't attach newer SQL server databases to older SQL Servers. 您不能将较新的SQL Server数据库附加到较旧的SQL Server。 Nor can you restore a backup from a newer SQL Server to an older SQL Server. 您也无法将备份从较新的SQL Server还原到较旧的SQL Server。

Your best option is scripting the structure and data in SQL 2012, and running the generated scripts on 2008. 最好的选择是在SQL 2012中编写结构和数据的脚本,并在2008上运行生成的脚本。

One option is to script the structure and data and execute these scripts against a SQL Server 2008 database. 一种选择是编写结构和数据的脚本,并针对SQL Server 2008数据库执行这些脚本。 To script a database 编写数据库脚本

  1. In SSMS Object Explorer right click a database 在SSMS Object Explorer中,右键单击数据库
  2. Select Tasks, Generate Scripts 选择任务,生成脚本
  3. Check 'Script all objects in the selected database' 选中“编写所选数据库中的所有对象的脚本”
  4. Set ' Script for Server version' to SQL Server 2008 将“服务器版本脚本”设置为SQL Server 2008
  5. Here's the catch - 'Script data' is set to false by default. 这就是要抓住的地方-默认情况下,“脚本数据”设置为false。 Set it to True to get the data scripted, too 将其设置为True也可以获取数据脚本
  6. When the script is created, create a database with the same name on SQL Server 2008 and execute the script 创建脚本后,请在SQL Server 2008上创建一个具有相同名称的数据库并执行脚本

Another option is to use a tool that will compare and synchronize the database on SQL Server 2012 and a blank database on SQL Server 2008. Most of these tools synchronize first structure and then data, so it's not a single click thing. 另一个选择是使用一种工具,该工具将比较和同步SQL Server 2012上的数据库以及SQL Server 2008上的空白数据库。这些工具中的大多数都首先同步结构,然后再同步数据,因此这并非一click而就。

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

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