简体   繁体   中英

How to export a database from SQL server 2008 to SQL server 2005

I have a database which I made using SQL server 2008. I have to attach this database into SQL server 2005. When I try to do so , I got an error since the database is made in higher version (2008). How can I do so? Any help ?

You cannot attach a SQL Server 2008 database to a SQL Server 2005 instance. Not even when using SQL Server 2005 compatibility level.

I'd recommend creating a new database on the SQL Server 2005 instance and use SQL Server Integration Services to copy the tables, indexes, etc. from the SQL Server 2008 database over to the new database.

In situations like this, I'll create a blank database on the 2005 server, and then grab my favorite Schema Diff tool and do a diff of the 2008 against the blank 2005 database, and push the schema changes over to the 2005 database. Once that's done, you can do a Data Diff (again with the tool of your choice) and move the data the same way. You may have to adjust some things if you've used any of the new datatypes in 2008 that don't exist in 2005.

You could also use RedGate's SQL Compare and SQL Data Compare to do this migration more easily. This is a commercial tool. You can download a demo copy from their website.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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