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

来源:互联网 发布:java中的方法有什么 编辑:程序博客网 时间:2024/06/18 15:18
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 collationidfrom syscolumns

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

  EXEC   sp_configure  'allow updates',1  
RECONFIGURE  WITH   OVERRIDE

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

  update syscolumnsset collationid= 49162--new
where collationidin (1359003656)--old

6. 关闭更新系统表功能

 EXEC   sp_configure  'allow updates',0  
RECONFIGURE  WITH   OVERRIDE 

OK.

原创粉丝点击