现在的位置: 首页 > 综合 > 正文

SQL Server 2000中修改数据库COLLATE一例

2012年08月02日 ⁄ 综合 ⁄ 共 532字 ⁄ 字号 评论关闭

1. 要确定没有其他人连接当前的数据库. 可以用sp_who查看,再用kill @spid强制关闭其连接.

2. 执行SQL,修改DB的Collate属性

 

USE [master]
GO
ALTER DATABASE [My_DB] COLLATE Finnish_Swedish_CS_AS
GO

 

 

3. 得到原先用到的Collate

 

Use [My_DB]
select distinct collationid from syscolumns

 

4. 设置允许更新系统表(注意, SQL Server 2005中,你无法更新系统表!)

 

EXEC   sp_configure   'allow updates',1   
RECONFIGURE   WITH   OVERRIDE 

 

5.将第三步得到的collationid,更新为新的

 

update syscolumns set collationid = 49162 --new 
where collationid in (1359003656--old

 

6. 关闭更新系统表功能

EXEC   sp_configure   'allow updates',0   
RECONFIGURE   WITH   OVERRIDE  

 

OK.

抱歉!评论已关闭.