将使用 SQL Server Express 2008 创建的 mdf 导入 SQL Server 2005 时出现问题
这个问题可能非常容易解决,但我需要解决它,因为我需要继续我的项目。我在家使用 SQL Server Express 2008,并且一直在开发 ASP.NET MVC 应用程序,该应用程序将我的数据库存储在项目文件夹中的 mdf 文件中。问题是Uni实验室中的SQL Server是SQL Server 2005,当我尝试使用VS Server Explorer打开mdf文件时,它说mdf文件的版本超过服务器可以接受的版本。
我想到的唯一选择是将数据库导出为 sql 文件,就像我使用 phpmyadmin 做过上千次一样。问题是 SQL Management Studio Express 并不是世界上最有用的工具,并且出于某种奇怪的原因,我在 Google 中找到的所有文章都是无关紧要的。请帮忙。
The question is probably extremely easy to resolve, but I need to resolve it because I need to carry on with my project. I am using SQL Server Express 2008 at home, and I've been working on an ASP.NET MVC app that stores my DB in an mdf file in the project's folder. The problem is that the SQL Server in the Uni labs is SQL Server 2005, and when I try to open the mdf file with the VS Server Explorer,It says that the version of the mdf file is more than the server can accept.
The only option that comes to my mind is exporting the DB as an sql file, just like I've done it thousand times with phpmyadmin. the thing is that the SQL Management Studio Express is not the most usable tool in the world, and for some strange reason all the articles I could find in Google were irrelevant. Please, help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
无法将在 SQL Server 2008 上创建的数据库附加到 SQL Server 2005。其他方向也是可能的。
您唯一的选择是编写数据库和数据脚本并在 SQL 2005 上运行脚本。如果您使用过 SQL Server 2008 的任何新功能,则必须重写脚本。
It is not possible to attach database created on SQL Server 2008 to SQL Server 2005. The other direction is possible.
Your only option is to script the database and data and run the scripts on SQL 2005. If you have used any of new features of the SQL Server 2008, you will have to rewrite the scripts.
我没怎么用过,但是右键数据库->任务... ->生成脚本.../导出数据.../导入数据...应该可以正确完成工作。
I haven't used it much, but right click on database -> Tasks... -> Generate Scripts... / Export Data... / Import Data... should do the job right.
Google“数据库发布向导”,它是 Microsoft 的一个工具,用于编写整个数据库(包括架构和数据)的脚本。
Google "Database Publishing Wizard", it's a tool from Microsoft to script an entire database, both schema and data.
您可以编写数据库及其数据的脚本。然后在目标服务器上运行它以创建与2005版本兼容的新数据库。
you can script your db and its data. then run it on the target server to create a new db that is compatible with 2005 version.
Red-Gate SQL Compare 和 SQL Data Compare 可以将实时数据库与备份文件等进行比较,以便您可以比较您的 SQL Server 2005 数据库针对 SQL Server 2008 Express 备份文件,并以这种方式移动数据。
或者,您可以使用 此工具为已更改数据的表生成 INSERT 语句这里或这里这个。它们可以为您的表生成 INSERT 脚本,您可以随身携带该脚本并在 SQL Server 2005 目标系统上运行。
Tools like Red-Gate SQL Compare and SQL Data Compare can compare a live database to e.g. a backup file, so you could compare your SQL Server 2005 database against the SQL Server 2008 Express backup file, and move data that way.
Or you could possibly generate INSERT statements for your tables that have changed data using a tool like this one here or this one here. These can generate INSERT scripts for your tables, which you can take along and run on your SQL Server 2005 target system.