Translate

Wednesday 9 January 2013

Latein General Collation Error in Sql Server


1.    ALTER DATABASE DBName
       SET SINGLE_USER WITH ROLLBACK IMMEDIATE;


2.   ALTER DATABASE DBName
     COLLATE Latin1_General_CI_AI;

3.  ALTER DATABASE DBName
     SET Multi_USER

4. we have used any split function in above DBName, Error will be occur. So we have to drop the split function and exec the above query.


latin collation error when creating or executing stored procedure:


we have create any temp table when creating stored procedure, which column we check to permanent table column, and those collation of column  may be not equal.

check the collation:
SELECT
col.name, col.collation_name
FROM
sys.columns col
WHEREobject_id = OBJECT_ID('TableName')

Modify coolation:

ALTER TABLE TableNameALTER COLUMN ColumnName
VARCHAR(100) COLLATE SQL_Latin1_General_CP1_CI_AI NOT NULL

Solution for following error

Cannot resolve the collation conflict between "Latin1_General_CI_AI" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation.

Error will be occur when we create Temp Table and match some column or update column from temp table. so we create temp table from source table

EX:


Select EmpNo ,Empname ,Age Into #Temp_EMP
 From tbl_Employee Where 1 = 2

http://www.mssqltips.com/sqlservertip/2440/create-sql-server-temporary-tables-with-the-correct-collation/