SQL Server Error 446: Fix Collation Conflict Between Databases
In this article
SQL Server Error 446 occurs when two strings with different collations are compared or joined in a query, and SQL Server cannot automatically resolve which collation to use. This commonly happens when querying across databases with different default collations, or when joining tables from different servers. The fix requires explicitly aligning collations using the COLLATE clause. This guide walks you through identifying and resolving this error safely and permanently.
What You'll Need
- Access to SQL Server Management Studio (SSMS) or another SQL client with query execution permissions
- Administrative or db_owner permissions on the databases involved
- Knowledge of which databases or tables are involved in the query causing the error
- Backup of your database (recommended before making schema changes)
Step-by-Step
- Identify the exact query causing Error 446. Look in your application logs, SQL Server Profiler, or SSMS query results for the full error message, which typically reads: "Cannot resolve collation conflict between \"CollationName1\" and \"CollationName2\" in \"operator\"". Note the operator (e.g., =, LIKE, JOIN) and the two collation names.
- Find the collation of each database involved. Run this query for each database:
SELECT name, collation_name FROM sys.databases WHERE name IN ('Database1', 'Database2');Replace Database1 and Database2 with the actual names from your error message. - Locate the specific columns involved in the comparison. Run:
SELECT COLUMN_NAME, COLLATION_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'TableName' AND TABLE_SCHEMA = 'SchemaName' AND COLUMN_NAME IN ('Column1', 'Column2');Use the table and column names from your query. This confirms whether the conflict is between database defaults or column-specific collations. - Choose a target collation to unify the comparison. Use a collation that supports all required characters and is consistent across your environment—commonly
SQL_Latin1_General_CP1_CI_ASorLatin1_General_CI_AS. Avoid using database default collations unless they are identical. - Modify your query to explicitly COLLATE one side to match the other. For example, if joining two tables with conflicting collations:
SELECT * FROM Table1 t1 JOIN Table2 t2 ON t1.Name COLLATE SQL_Latin1_General_CP1_CI_AS = t2.Name COLLATE SQL_Latin1_General_CP1_CI_AS;Apply COLLATE to both sides of the comparison to ensure symmetry and avoid ambiguity. - If the conflict occurs in a WHERE clause, apply COLLATE similarly:
WHERE ColumnA COLLATE Latin1_General_CI_AS = 'value';Always use the same collation on both sides of the operator. - For views, functions, or stored procedures causing the error, edit the object definition to include COLLATE in all string comparisons. Use ALTER VIEW, ALTER FUNCTION, or ALTER PROCEDURE to update the code.
- Test the corrected query with sample data that includes special characters (e.g., accented letters, symbols) to ensure proper sorting and matching behavior.
- If the issue persists across multiple queries, consider standardizing the collation of the affected databases. Use:
ALTER DATABASE DatabaseName COLLATE Latin1_General_CI_AS;This changes the default collation for new objects but does not alter existing columns—useALTER TABLE ... ALTER COLUMNto update existing string columns to the new collation. - After changing a database collation, rebuild all indexes on string columns to avoid performance degradation:
ALTER INDEX ALL ON TableName REBUILD;
Common Mistakes
- Applying COLLATE to only one side of a comparison—this can still cause errors if SQL Server cannot infer a consistent resolution.
- Using COLLATE on a column that has an index—the query may not use the index efficiently, leading to slow performance. Always test execution plans after adding COLLATE.
- Assuming changing the database collation will fix existing columns—it only affects new columns. Existing columns retain their original collation unless explicitly altered.
- Using COLLATE with temporary tables or table variables—their collation is inherited from tempdb, which may differ from your user databases, causing new conflicts.
- Trying to resolve the issue by changing server-level collation—this is a destructive, complex process requiring a full rebuild of the master database and is never recommended for production environments.
Tips
- Use the COLLATE option sparingly. It's a temporary fix. Long-term, standardize collation across all databases in your environment.
- When creating new databases, explicitly specify the collation:
CREATE DATABASE NewDB COLLATE Latin1_General_CI_AS; - Use the
COLLATIONPROPERTY()function to compare collation properties:SELECT COLLATIONPROPERTY('SQL_Latin1_General_CP1_CI_AS', 'CodePage'); - For cross-server queries (linked servers), ensure remote column collations are compatible or use explicit COLLATE in OPENQUERY.
- Document all collation changes in your configuration management system to prevent future mismatches.
- Use SQL Server Data Tools (SSDT) or schema comparison tools to audit collation consistency across environments.
Troubleshooting
If the error persists after applying COLLATE:
- Restart SQL Server Management Studio. Sometimes, cached metadata causes false errors.
- Check that the COLLATE clause is applied in all places where the column is used—including CASE statements, subqueries, and computed columns.
- Verify that temporary tables used in the query do not rely on tempdb’s default collation. When declaring table variables or #temp tables, explicitly define string columns with a collation:
CREATE TABLE #Temp (Name NVARCHAR(50) COLLATE SQL_Latin1_General_CP1_CI_AS); - If using a view or function that references multiple databases, recompile it:
EXEC sp_recompile 'YourViewName'; - Run
SELECT DATABASEPROPERTYEX('DatabaseName', 'Collation');to double-check the active collation after any ALTER DATABASE command. - If you changed a database collation but still see the error, search for any string columns that were not updated:
SELECT TABLE_NAME, COLUMN_NAME, COLLATION_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'dbo' AND COLLATION_NAME IS NOT NULL AND COLLATION_NAME <> 'Latin1_General_CI_AS';Then update them individually. - If the query involves a third-party application or vendor database, consult the vendor’s documentation before modifying collations—they may have specific compatibility requirements.
Frequently Asked Questions
Can I ignore this error and let SQL Server choose a collation?
No. SQL Server cannot auto-resolve the conflict without explicit instructions. The error will always occur unless you specify the collation in the query.
Does changing collation affect performance?
Yes. Applying COLLATE to indexed columns can prevent index usage, forcing table scans. Always test execution plans and consider rebuilding indexes after collation changes.
Why do two databases have different collations?
Databases inherit collation from the model database at creation time. If created on different servers, with different default collations, or during different SQL Server versions, they may have mismatched defaults.
Can I use COLLATE in a WHERE clause with a parameter?
Yes. Example: WHERE Name COLLATE Latin1_General_CI_AS = @SearchTerm COLLATE Latin1_General_CI_AS; Both sides must match.
Is it safe to change a production database’s collation?
It is possible but risky. Always backup first. Test on a replica. Changing collation can break applications expecting specific sorting behavior, especially with accents or case sensitivity.
What’s the difference between SQL_Latin1_General_CP1_CI_AS and Latin1_General_CI_AS?
SQL_Latin1_General_CP1_CI_AS is a SQL Server-specific collation with legacy sorting rules. Latin1_General_CI_AS is a Windows collation that follows OS sorting rules. Both are widely compatible, but Windows collations are preferred in modern deployments.