Moving SQL Server 2005 Express databases to SQL Server 2000

23/06/2010 UPDATE
The database publishing wizard is integrated within Visual Studio 2008/2010.

Further information can be found here.

As you might well imagine, the on disk structure for SQL Server 2005 differs from that of SQL Server 2000.

Indeed, restoring a SQL Server 2005 [Express] database backup for use with SQL Server 2000 isn’t really the done thing, as this post confirms.

After a little head-scratching with the SQL Server 2005 Express data export and scripting options, I deemed it necessary to create a SQL script that was not only capable of creating the database structure, but was also able to create all the INSERT statements necessary to recreate the data too. And it had to create SQL suitable for SQL Server 2000’s dialect…

Further head-scratching led me to the Microsoft SQL Server Database Publishing Wizard. It does exactly what I needed and allowed me to move a SQL Server 2005 database back down to SQL Server 2000, as these screenshots confirm:



So, in a nutshell, here’s what I did:

  1. Ran the Database Publishing Wizard against my SQL Server 2005 Express database.
  2. Created a SQL Server 2000-compliant SQL script that contained all the SQL statements required to create the database. The SQL script also created all the INSERT statements required to populate the tables in the database.
  3. Created a new blank database in SQL Server 2000.
  4. Ran the SQL script from step 2 against the SQL Server 2000 database – using the Query Analyser.

Of course, there’s often more than one way to skin a cat, your mileage may vary.

Technorati Tags: , , , , , ,