1. Modify the collation of the database
ALTER DATABASE [CHARACTER] COLLATE chinese_prc_ci_as;
2. Modify the collation of the columns in the table
You cannot change the collation of a column if one of the following is currently referencing one.
- Computed columns
- Index
- Auto-generated or generated distribution statistics by the Create STATISTICS statement
- CHECK constraint
- FOREIGN KEY Constraint
--------------------------Modify the collation of a character column in a database table-----------------------------
1 DECLARE @S NVARCHAR( +)2 DECLARECCURSOR for -- Case insensitive3 SELECT 'ALTER TABLE ['+B.name+'] ALTER COLUMN ['+A.name+'] '+Type_name (A.xtype)+4 Case whenType_name (A.xtype)inch('TEXT','NTEXT') Then "' ELSE5 QUOTENAME(A.length,'(')6 END +'COLLATE chinese_prc_ci_as'7 fromsyscolumns A8 JOINSYSOBJECTS B ona.ID=b.ID andB.type='U'9 WHEREType_name (A.xtype)inch('VARCHAR','CHAR','NVARCHAR','NCHAR','TEXT','NTEXT')Ten OPENC One FETCHC into @S A while @ @FETCH_STATUS=0 - BEGIN - EXEC(@S) the FETCHC into @S - END - CLOSEC - deallocateC + GO
MSSQL Modify the collation of the database