2

Does SQL Server allow triggers on extended properties, table level or column level?

If not, is there anything like a trigger that can detect an 'add' or 'update' on extended properties and execute a stored procedure automatically?

Thank you!

S3S
  • 24,809
  • 5
  • 26
  • 45
Eleanor
  • 2,647
  • 5
  • 18
  • 30

1 Answers1

2

You can use a DDL trigger for this.

CREATE TRIGGER foo
ON DATABASE
FOR CREATE_EXTENDED_PROPERTY, ALTER_EXTENDED_PROPERTY
AS
  BEGIN
      /*TODO: Something useful here*/
      SELECT EVENTDATA()
  END 
Martin Smith
  • 438,706
  • 87
  • 741
  • 845
  • @Brian - RE your comment on the now deleted answer these specific events exist as far back as SQL Server 2008. I don't have 2005 to test. – Martin Smith Nov 02 '18 at 20:22