sp_addextendedproperty
语法
sp_addextendedproperty
[ @name = ] { 'property_name' } --添加的属性的名称
[ , [ @value = ] { 'value' } --与属性关联的值
[ , [ @level0type = ] { 'level0_object_type' } --是级别0对象的类型
, [ @level0name = ] { 'level0_object_name' } --是指定的0级对象类型的名称
[ , [ @level1type = ] { 'level1_object_type' } --是级别1对象的类型
, [ @level1name = ] { 'level1_object_name' } --是指定的1级对象类型的名称
[ , [ @level2type = ] { 'level2_object_type' } --是2级对象的类型
, [ @level2name = ] { 'level2_object_name' } --是指定的2级对象类型的名称
]
]
]
]
[;]
---将扩展属性添加到表中的列
CREATE TABLE [dbo].[SYS_UserPermissions](
[ID] [int] PRIMARY KEY NOT NULL,
[UserID] [int] NOT NULL,
[xType] [tinyint] NULL,
[ElementID] [int] NOT NULL,
[Permission] [smallint] NULL,
[Modifier] [varchar](20) NULL,
[ModifyDate] [datetime] NULL,
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SYS_UserPermissions', @level2type=N'COLUMN',@level2name=N'ID'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'角色ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SYS_UserPermissions', @level2type=N'COLUMN',@level2name=N'UserID'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'类型' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SYS_UserPermissions', @level2type=N'COLUMN',@level2name=N'xType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'元素ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SYS_UserPermissions', @level2type=N'COLUMN',@level2name=N'ElementID'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'权限' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SYS_UserPermissions', @level2type=N'COLUMN',@level2name=N'Permission'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'用户独立权限表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SYS_UserPermissions'
GO