獲取 增加 修改 刪除sqlserver欄位描述

2021-08-29 16:50:01 字數 1234 閱讀 9730

[url]

select o.name as tablename, c.name as columnname, p.[value] as description

from sysproperties p inner join

sysobjects o on o.id = p.id inner join

syscolumns c on p.id = c.id and p.smallid = c.colid

where (p.name = 'ms_description') and (c.name = 'province') and (o.name = 'ip_address')

order by o.name

選取表ip_address中 欄位province的描述

--建立表及描述資訊

create table 表(a1 varchar(10),a2 char(2))

--為表新增描述資訊

execute sp_addextendedproperty n'ms_description', '人員資訊表', n'user', n'dbo', n'table', n'表', null, null

--為字段a1新增描述資訊

execute sp_addextendedproperty n'ms_description', '姓名', n'user', n'dbo', n'table', n'表', n'column', n'a1'

--為字段a2新增描述資訊

execute sp_addextendedproperty n'ms_description', '性別', n'user', n'dbo', n'table', n'表', n'column', n'a2'

--更新表中列a1的描述屬性:

exec sp_updateextendedproperty 'ms_description','欄位1','user',dbo,'table','表','column',a1

--刪除表中列a1的描述屬性:

exec sp_dropextendedproperty 'ms_description','user',dbo,'table','表','column',a1

--刪除測試

drop table 表

增加 修改 刪除

alter alter table student add column 學歷 varchar 20 新增一欄位 學歷 alter alter table student add 星座 char 50 not null after 性別 在性別之後新增一欄位星座 update update stud...

DELPHI 查詢,增加,修改,刪除

unit unit1 inte ce uses windows,messages,sysutils,variants,classes,graphics,controls,forms,dialogs,grids,dbgrids,db,adodb,stdctrls type tform1 class t...

MySQL增加 修改 刪除字段

1 增加字段 語法 alter table 表名 add 列名 字段型別 示例 alter table perple add name varchar 200 改進 增加預設值 alter table perple add name varchar 200 default null 增加備註 alt...