SQL Server 2000中修改數(shù)據(jù)庫COLLATE的實例

字號:


    1. 要確定沒有其他人連接當(dāng)前的數(shù)據(jù)庫. 可以用sp_who查看,再用kill @spid強(qiáng)制關(guān)閉其連接.
    2. 執(zhí)行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. 設(shè)置允許更新系統(tǒng)表(注意, SQL Server 2005中,你無法更新系統(tǒng)表!)
    EXEC sp_configure 'allow updates',1
    RECONFIGURE WITH OVERRIDE
    5.將第三步得到的collationid,更新為新的
    update syscolumns set collationid = 49162 --new
    where collationid in (1359003656) --old
    6. 關(guān)閉更新系統(tǒng)表功能
    EXEC sp_configure 'allow updates',0
    RECONFIGURE WITH OVERRIDE
    OK.