Cannot resolve collation conflict for UNION operation
Versions:
n/a,
FAQ number:
75,
Old FAQ number: 998
This error occurs when the EPiServer database does not have the same collation as system default collaction or that the individual tables have another collation than the database default collation. The most common reasons for this is:
- You restored the database from another server/database with another collaction.
- You performed a transfer of the database from antoher server/database with another collection.
- You transfered the database from a SQL Server 7 to SQL Server 2000.
To correct this problem you need to use the SQL Server Enterprise Manager - the following instructions assume a certain degree of familiarity with this tool.
- Check if the EPiServer database has the default system collation. If yes, go directly to step 4
To check the system collation, open SQL Server Enterprise Manager and open the Database folder for your server. Right-click on the tempdb database and see the "Collation name" at the bottom of the "General" tab.
To check the collation on your EPiServer database, repeat the same procedure but select your database. If the collation names differ, your database is not set up with the system collation.
- Create a new database which will be the new EPiServer database.
If you are using the SQL Server Enterprise Manager, make sure that you leave the "Collation name" dropdown set to "(Server default)".
Set up all other information to the same settings as your original database. Be sure to add the same database user to the new database and give that user DBO permissions.
- Transfer the old database content to the new database.
With the SQL Server Enterprise Manager, use the "Export Data" task. Select the old database as Source and the new database as Destination.
Select the option "Copy objects and data between SQL Server databases".
Unselect the "Use default options" checkbox, click the "Options" button and unselect "Copy database users and database roles" and "Copy object-level permissions".
Simply continue with the Wizard and leave all other settings at the selected defaults. The database contents is now transferred to the new database with the correct collation.
- Verify that all NCHAR/TEXT/NVARCHAR columns in the database is set to collation "Database default".
For each table in the new database, open the table in Design mode and select each NCHAR/TEXT/NVRACHAR column and select collaction <database default> if it is not already selected.
This will take about 10 - 20 minutes of frantic clicking.
There is a script that can automate this process, but the resulting database will no longer have any "Not null" restrictions on columns that require this setting. I e a database converted with this script is not suitable for a production environment.
The database should now be using the system default collation and the error message should no longer appear.