Go Collation of SQL SERVER

Source: Internet
Author: User

How to change the collation of SQL SERVER 2000

Alter Datebase ALTER DATEBASE database Chinese_prc_bin

ALTER TABLE TB
ALTER COLUMN colname nvarchar (+) COLLATE chinese_prc_ci_as
--Case insensitive
ALTER TABLE TB
ALTER COLUMN colname nvarchar (+) COLLATE chinese_prc_cs_as
--Case sensitive


You can get more rules by using the following command:
SELECT *
From:: Fn_helpcollations ()


After you change the collation of the database, the collation of the fields in the table remains the same, and if you go to a field in the Enterprise Manager interface in the design table, a field change is tiring,
EXEC sp_configure ' allow updates ', 1 RECONFIGURE with OVERRIDE

Update dbo.syscolumns set collationid=65572 where collationid=53284

EXEC sp_configure ' allow updates ', 0 RECONFIGURE with OVERRIDE
Go


When you modify the collation of the database, make sure that your database does not have any connections.

It is best to change the database name in the Query Analyzer using the following method:

/*
Turn off user-opened process processing
*/
Use master
Go

if exists (SELECT * from dbo.sysobjects WHERE id = object_id (N ' [dbo].[ P_killspid] ') and OBJECTPROPERTY (ID, N ' isprocedure ') = 1)
drop procedure [dbo]. [P_killspid]
GO

Create proc P_killspid
@dbname varchar (200)--the database name of the process to be closed
As
declare @sql nvarchar (500)
declare @spid nvarchar (20)

DECLARE #tb cursor FOR
Select Spid=cast (spid as varchar) from master: sysprocesses where dbid=db_id (@dbname)
Open #tb
FETCH NEXT from #tb into @spid
While @ @fetch_status =0
Begin
EXEC (' kill '[email protected])
FETCH NEXT from #tb into @spid
End
Close #tb
Deallocate #tb
Go

--Close User connection
EXEC p_killspid ' database name '
Go

--Modify Collation
Alter Datebase ALTER DATEBASE database name Chinese_prc_bin

Go Collation of SQL SERVER

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.