如何更改SQL SERVER 2000的排序規(guī)則
Alter datebase Alter datebase 數(shù)據(jù)庫 Chinese_PRC_BIN
ALTER TABLE tb
ALTER COLUMN colname nvarchar(100) COLLATE Chinese_PRC_CI_AS
--不區(qū)分大小寫
ALTER TABLE tb
ALTER COLUMN colname nvarchar(100) COLLATE Chinese_PRC_CS_AS
--區(qū)分大小寫
使用如下命令,可以獲得更多的規(guī)則:
SELECT *
FROM ::fn_helpcollations()
更改數(shù)據(jù)庫排序規(guī)則后,表中字段的排序規(guī)則仍然沒變,如果在企業(yè)管理器中在設(shè)計表的界面去一個字段一個字段的改太累人了,
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
修改數(shù)據(jù)庫的排序規(guī)則的時候,要確保你的數(shù)據(jù)庫沒有任何連接.
最好在查詢分析器中用下面的方法,注意修改數(shù)據(jù)庫名:
/*
關(guān)閉用戶打開的進程處理
*/
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) --要關(guān)閉進程的數(shù)據(jù)庫名
as
declare @sql nvarchar(500)
declare @spid nvarchar(20)
declare #tb cursor for
select spid=cast(spid as varchar(20)) from master..sysprocesses where dbid=db_id(@dbname)
open #tb
fetch next from #tb into @spid
while @@fetch_status=0
begin
exec('kill '+@spid)
fetch next from #tb into @spid
end
close #tb
deallocate #tb
go
--關(guān)閉用戶連接
exec p_killspid '數(shù)據(jù)庫名'
go
--修改排序規(guī)則
Alter datebase Alter datebase 數(shù)據(jù)庫名 Chinese_PRC_BIN
分享名稱:Cannotresolvethecollationconflictbetween"Chinese_PRC_CI_AS"
文章網(wǎng)址:
http://weahome.cn/article/igscjd.html