Как обновить расширенные свойства столбца?
Вопросы действительно говорят сами за себя, возможно ли обновить расширенное свойство столбца в таблице. Я искал онлайн, но они, кажется, показывают только обновление расширенного свойства для таблицы, а не столбцов в таблице.
1 ответ
Решение
EXECUTE sp_updateextendedproperty
N'MS_Description',
@v,
N'SCHEMA', N'dbo',
N'TABLE', N'Table_1',
N'COLUMN', N'i'
На самом деле это самый первый пример в теме MSDN:
http://technet.microsoft.com/en-us/library/ms186885.aspx
Вот более полный пример:
--Add extended property
EXEC sp_addextendedproperty
@name = N'Question1'
,@value = N'Hello'
,@level0type = N'Schema', @level0name = dbo
,@level1type = N'Table', @level1name = Acceptance
,@level2type = N'Column', @level2name = P101;
GO
--Verify
SELECT * FROM fn_listextendedproperty
(NULL, 'schema', 'dbo', 'table', 'Acceptance', 'column', 'P101');
GO
--Update the extended property.
EXEC sp_updateextendedproperty
@name = N'Question1'
,@value = N'Hello, What is your name'
,@level0type = N'Schema', @level0name = dbo
,@level1type = N'Table', @level1name = Acceptance
,@level2type = N'Column', @level2name = P101;
GO
--Verify
SELECT * FROM fn_listextendedproperty
(NULL, 'schema', 'dbo', 'table', 'Acceptance', 'column', 'P101');
GO