在SQL Server2000中修改系统表

要求将数据库中所有的表名和列名全部改为大写,首先想到的就是在系统表中修改,数据库中的表名放在sysobjects表下,列名则放在syscolumns表下。
   通常系统表是不可修改的,修改系统表之后出错,提示需要将allow update配置开关开启。写了下面的脚本
EXEC sp_configure 'allow update','1'
GO

UPDATE syscolumns SET syscolumns.name=upper(syscolumns.name)
WHERE syscolumns.name IN
(
SELECT syscolumns.name
FROM  syscolumns,sysobjects
WHERE syscolumns.id=sysobjects.id
AND sysobjects.xtype='U'
)
GO

UPDATE sysobjects SET sysobjects.name=upper(sysobjects.name)
WHERE sysobjects.xtype='U'
GO

EXEC sp_configure 'allow update','0'
GO

结果还是出错,最后一查,发现配置allow update时要带上RECONFIGURE WITH OVERRIDE命令,SQL Server Books Online是这样描述的:
  Updates the currently configured (the config_value column in the sp_configure result set) value of a configuration option changed with the sp_configure system stored procedure. Because some configuration options require a server stop and restart to update the currently running value, RECONFIGURE does not always update the currently running value (the run_value column in the sp_configure result set) for a changed configuration value.

原来如些阿,呵呵。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值