DECLARE @tableName varchar (200)
DECLARE @tableDesc varchar (200)
DECLARE @sql varchar (8000)
DECLARE @c int
Set @tableName = N ' B_YHBM '; --Table name
Set @tableDesc = N ' Organization-person login information '; --Description information (requires module + table description) such as main program-Permission category
--Determine if you have completed
Select @c = COUNT (*) from sys.extended_properties a WHERE a.major_id = object_id (@TableName) and name = ' Ms_description ' A nd minor_id = 0;
IF @c <= 0
BEGIN--Add
EXEC [SYS]. [Sp_addextendedproperty] @name = n ' ms_description ', @value = @tableDesc, @level0type = N ' SCHEMA ', @level0name = n ' dbo ', @l Evel1type = N ' TABLE ', @level1name = @tableName;
END
ELSE
BEGIN--Modify
EXEC [SYS]. [Sp_updateextendedproperty] @name = n ' ms_description ', @value = @tableDesc, @level0type = N ' SCHEMA ', @level0name = n ' dbo ', @level1type = N ' TABLE ', @level1name = @tableName;
END
GO