Question

I have a database that I need to move and I need to meet the following goals:

  1. I have to change the collation
  2. I need to upgrade it from a 2005 DB to a 2008 DB with all keys and constraints intact.

I would think this would be a rather simple procedure, but it appears to be hugely complicated. Mostly I am sure I don't understand the complexities I am dealing with. Here is what I have attempted to accomplish what I am doing:

A. I have used the SQL Manager to import from one database to another. While this works great for fixing the collation, I lose all the keys. B. I scripted the table creation so I get all the keys and constraints, but then can't import the database because of them.

I am not any SQL expert by any means, but I love learning. I have been working on this for weeks and just want to get it done at this point. Any help would be greatly appreciated.

Some other notes: I am running MS SQL Server. A 2005 as default instance. A 2008 as a named instance. Both of these run on the same server.

Was it helpful?

Solution

Found a blogpost with a script that alters all collation on database objects. Haven't tried it out myself so use with caution!. Always make a full backup or even better use a non production server to try it out.

Alter the :SETVAR variables to correspond with your database and collation.

Once the collation is set right you can create a backup on SQL server 2005 and restore the database on the SQL server 2008 instance. There should be no need to import the database.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top