Domanda

The questions really says it all, Is it possible to update an extended property of a column in a table. I have been looking around online but they only seem to show updating the extended property for a table and not the columns in a table.

È stato utile?

Soluzione

EXECUTE sp_updateextendedproperty 
N'MS_Description', 
@v, 
N'SCHEMA', N'dbo', 
N'TABLE', N'Table_1', 
N'COLUMN', N'i'

It's actually the very first sample in MSDN topic:

http://technet.microsoft.com/en-us/library/ms186885.aspx

Here's a more complete sample:

--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
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top