Back

Topic

[KB585]How to change database collation

Tags: MSSqlServer, SQL Server

12 years ago
By ACHT
Options
Print
Applies to:

SQL Server.


Summary:

This article explains how to modify collation to avoid conflict between two databases. If collation is not the same on the two replicated databases, replication fails.


Details:

Replication fails with a message like this:

Cannot resolve the collation conflict between “Latin1_General_CI_AS” and “French_CI_AS” in the equal to operation.

In this case, it is mandatory to have the same collation for each database.

  1. Launch Sql Server Management Studio.
  2. Right click on the desired database and edit properties.
  3. In the database properties, choose Options and change collation:

collation

Collation is also defined at the SQL Server level. You must also check that both SQL Servers use the same collation.

  • To modify the SQLserver collation you can use a DOS command:

C:\Program Files (x86)\Microsoft SQL Server\100\Setup Bootstrap\SQLServer2008R2>setup /QUIET /ACTION=REBUILDDATABASE /INSTANCENAME=<sql_serveur_name>/SQLSYSADMINACCOUNTS=<machine_name>\<database_connection_account> /SAPWD=<password>/SQLCOLLATION=French_CI_AS

  • To modify the database collation you can use an SQL query:

ALTER DATABASE <datavbqse_name> COLLATE French_CI_AS

  • To check the SQL server collation you can use an SQL query;

SELECT CONVERT(varchar,SERVERPROPERTY(‘collation’))

  • To check the SQL server collation you can use an SQL query;

SELECT CONVERT(varchar,DATABASEPROPERTYEX(‘<database_name>’,’collation’))

For further information about collation try searching the Microsoft document website, docs.microsoft.com, for the phrase Collation.


Created on: 26 Jul 2012 Last update: 04 Sep 2024