locked
Cannot Resolve the Collation Conflict. RRS feed

  • Question

  • Cannot Resolve the Collation Conflict.

    After fresh installation of  SQL Server 2008  R2 default  instance , (full feature ), we received the following error message while using SQL Server Management Studio:


    Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)
    Additional information:
    An exception occurred while executing a Transact-SQL statement or batch.
    (Microsoft.SqlServer.ConnectionInfo)
    Cannot resolve the collation conflict between "Latin1_General_CI_AS_KS_WS" and "SQL_Latin1_General_CP1_CI_AS" in the UNION operation. (Microsoft SQL Server, Error:468)

    Monday, June 11, 2012 7:43 AM

Answers

All replies

  • You probably have  SELECT statement that JOIN between tables on columns that have different collation, so to resolve it

    SELECT <columns> FROM t1 JOIN t2 ON t1.col=t2.col COLLATE database default --or (Latin1_General_CI_AS_KS_WS)


    Best Regards,Uri Dimant SQL Server MVP http://www.dfarber.com/microsoft-solutions/mssql-server.aspx http://www.dfarber.com/computer-consulting-blog.aspx http://sqlblog.com/blogs/uri_dimant/


    Monday, June 11, 2012 7:47 AM
    Answerer
  • No

    This is happening  when opening sql server management studio

    Monday, June 11, 2012 7:50 AM
  • Use COLLATE DATABASE_DEFAULT:

    SELECT ID
    FROM ItemsTable
    INNER JOIN AccountsTable
    WHERE ItemsTable.Collation1Col COLLATE DATABASE_DEFAULT
    = AccountsTable.Collation2Col COLLATE DATABASE_DEFAULT


    Monday, June 11, 2012 7:52 AM
  • Hmm, never seen it before, can you show a print screen here?

    Best Regards,Uri Dimant SQL Server MVP http://www.dfarber.com/microsoft-solutions/mssql-server.aspx http://www.dfarber.com/computer-consulting-blog.aspx http://sqlblog.com/blogs/uri_dimant/

    Monday, June 11, 2012 7:55 AM
    Answerer
  • Monday, June 11, 2012 7:57 AM
  • You are using T-SQL statement taht contains UNION, see above, can you post that statement here?

    Best Regards,Uri Dimant SQL Server MVP http://www.dfarber.com/microsoft-solutions/mssql-server.aspx http://www.dfarber.com/computer-consulting-blog.aspx http://sqlblog.com/blogs/uri_dimant/

    Monday, June 11, 2012 8:07 AM
    Answerer
  • HI

    Check this

    select name, collation_name from sys.databases

    -------------------

    Alter DATABASE KLPD
    COLLATE SQL_Latin1_General_CP1_CI_AS

    Monday, June 11, 2012 9:19 AM
  • I cannot reproduce the  error , i think when  i was checking the Database properties or login properties  the error pop ups .

    Now i cant see the error

    Monday, June 11, 2012 9:43 AM
  • A similar issue and solution is discussed in the following link:

    Cannot Resolve the Collation Conflict.


    Krishnakumar S

    Monday, June 11, 2012 12:40 PM
  • Well you could change:

    1. Server collation or
    2. Database collation or
    3. Use Collate in you query with union statement. This is the best way.
    Monday, June 11, 2012 12:47 PM
  • The options 1 and 2 are very complicated and not always done successful.  For option 2 is needed to create an empty database with correct collation and move all objects along with data over there.

    Best Regards,Uri Dimant SQL Server MVP,http://sqlblog.com/blogs/uri_dimant/

    Monday, June 11, 2012 12:53 PM
    Answerer
  • If it is while retriving data from tables, try following:

    Create tables with "COLLATE DATABASE_DEFAULT" for fields.

    The COLLATE clause can be applied only for the char, varchar, text, nchar, nvarchar, and ntext data types.

    http://msdn.microsoft.com/en-us/library/aa258237(v=sql.80).aspx


    Trilok Negi


    • Edited by Trilok Negi Monday, June 11, 2012 1:45 PM add link
    Monday, June 11, 2012 1:44 PM
  • If this happens when you start SSMS, that I would suspect you can different collations between the system databases (which I believe isn't supported), so this is what I would check.

    Tibor Karaszi, SQL Server MVP | web | blog

    Monday, June 11, 2012 2:27 PM
  • Thank you for all , I can't find the error (Actually i cant recall when  and where it happened ),At least  the error logged somewhere ?
    Monday, June 11, 2012 4:10 PM
  • No, that type of error will not be logged by the database engine. And since the client is SSMS, you won't find it logged there either...

    Tibor Karaszi, SQL Server MVP | web | blog

    Monday, June 11, 2012 5:01 PM
  • Hmm,try turning on SQL Profiler and see what is going on ....

    Best Regards,Uri Dimant SQL Server MVP,http://sqlblog.com/blogs/uri_dimant/

    • Proposed as answer by amber zhang Tuesday, June 19, 2012 2:24 AM
    • Marked as answer by amber zhang Wednesday, June 20, 2012 7:51 AM
    Monday, June 11, 2012 5:14 PM
    Answerer