--SQL code# --创建表及描述信息
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 表
举例如下:
创建一个仓库表
/*
创建仓库表
*/
if exists(select * from sysobjects where id=object_id(N'storage') and OBJECTPROPERTY(id, N'IsUserTable') = 1 )
drop table Storage
create table Storage
(
StorageId int primary key identity,
StorageName varchar(20)
)
EXECUTE sp_addextendedproperty N'MS_Description', '仓库表', N'user', N'dbo', N'table', N'Storage', NULL, NULL
exec sp_addextendedproperty N'Ms_description','主键,仓库ID',N'user',N'dbo',N'table',N'Storage',N'column',N'storageid'
exec sp_addextendedproperty N'Ms_description','仓库名称',N'user',N'dbo',N'table',N'Storage',N'column',N'storagename'
exec dbo.showtablefieldsinfo 'dbo.storage'