You should first attempt executing:
ALTER DATABASE [{db_name}] COLLATE {new_collation_name};
If you get errors, are they something simple to remove, then change the collation, then re-create, such as a small number of functions? If so, then do that.
If the errors related to items that cannot be easily changed, or are far too many things to change, then the next easiest way is the undocumented sqlservr.exe -q
method. That does a simple meta-data change of the collation_id
of each relevant column (relevant = column that can be changed; some system columns cannot be changed). This can lead to data corruption in VARCHAR
data if the code page changes, but in your case the code page is not changing. I have documented what this command does here:
Changing the Collation of the SQL Server Instance, the Databases, and All Columns in All User Databases: What Could Possibly Go Wrong?
If the instance has several databases on it that will not be changing, and/or if the instance-level collation itself will not be changing, then you can:
- Create a temporary instance of the same version of SQL Server (be sure to specify a collation that is not the collation of the target instance where this database will ultimately be restored to).
- Restore this one database to that temporary instance
- Use the
sqlservr.exe -q
method to update this temporary instance to the instance being used by the target instance.
- Backup / Detach this database from the temporary instance.
- Restore / Attach this database into the target instance.
- Assuming everything works as desired, stop and uninstall the temporary instance.