1. 程式人生 > >更改表字段的描述 SQL語句實現

更改表字段的描述 SQL語句實現

使用sp_configure 系統儲存過程
使用 sp_configure 時,必須在設定一個配置選項後執行 RECONFIGURE 或者 RECONFIGURE WITH OVERRIDE。RECONFIGURE WITH OVERRIDE 語句通常保留用於需要加倍小心的配置選項(例如,將 allow updates 選項設定為 1 使使用者得以更新系統表中的欄位)。但是,RECONFIGURE WITH OVERRIDE 可用於所有的配置選項,並且可以用它代替 RECONFIGURE。

例如:

sp_configure 'allow updates', 1
RECONFIGURE WITH OVERRIDE
update sysproperties
      set  value ='表字段描述文字'
 where smallid=
(
select  a.colid
   from  syscolumns a
where  a.id=object_id('資料庫名..表名)
    and  a.name='欄位名'
)