--取得表主键
exec sp_pkeys 'Users','dbo','ArticleRelease'
--取得表字段
select * from syscolumns where id = object_id('Users')
--取得字段说明
SELECT * FROM ::fn_listextendedproperty (NULL, 'user', 'dbo', 'table', 'Users', 'column', default) where name='MS_Description'
--添加字段说明
exec sp_addextendedproperty N'MS_Description',N'描述內容',N'user',N'dbo',N'table',N'表名',N'column',N'列名'
--修改字段说明
exec sp_updateextendedproperty N'MS_Description',N'描述內容',N'user',N'dbo',N'table',N'表名',N'column',N'列名'
--删除字段说明
exec sp_dropextendedproperty N'MS_Description',N'user',N'dbo',N'table',N'表名',N'column',N'列名'
--获得数据库列表(master库中)
select * from sysdatabases
--获得表列表
select * from sysobjects where xtype='U' and name<>'dtproperties'
exec sp_pkeys 'Users','dbo','ArticleRelease'
--取得表字段
select * from syscolumns where id = object_id('Users')
--取得字段说明
SELECT * FROM ::fn_listextendedproperty (NULL, 'user', 'dbo', 'table', 'Users', 'column', default) where name='MS_Description'
--添加字段说明
exec sp_addextendedproperty N'MS_Description',N'描述內容',N'user',N'dbo',N'table',N'表名',N'column',N'列名'
--修改字段说明
exec sp_updateextendedproperty N'MS_Description',N'描述內容',N'user',N'dbo',N'table',N'表名',N'column',N'列名'
--删除字段说明
exec sp_dropextendedproperty N'MS_Description',N'user',N'dbo',N'table',N'表名',N'column',N'列名'
--获得数据库列表(master库中)
select * from sysdatabases
--获得表列表
select * from sysobjects where xtype='U' and name<>'dtproperties'