SQL 2005
I have a table that is referenced by a view. Whenever a column is added or
dropped from a table I want to update the view to include or remove the
column - so I thought, 'DDL Trigger!'
I constructed my trigger and immediately found that the Alter Table is not
committed at the time the trigger is run - the trigger is in the same
transaction as the Alter Table - so the column does not exist yet.
What I am looking for is an AFTER DDL Trigger. Until then I guess I am off
to figure out Notification Services.In this case, a DDL trigger -- in my mind at least -- is for logging and/or
rolling back the change to the table.
What were you expecting to do to the table directly while in the scope of
the trigger?
"Joe L" <jjj@.lll.com> wrote in message
news:etW5zLJOGHA.3888@.TK2MSFTNGP12.phx.gbl...
> SQL 2005
> I have a table that is referenced by a view. Whenever a column is added
> or dropped from a table I want to update the view to include or remove the
> column - so I thought, 'DDL Trigger!'
> I constructed my trigger and immediately found that the Alter Table is not
> committed at the time the trigger is run - the trigger is in the same
> transaction as the Alter Table - so the column does not exist yet.
> What I am looking for is an AFTER DDL Trigger. Until then I guess I am
> off to figure out Notification Services.
>
>|||I was going to dynamically update my view to include/remove the column that
was just added or dropped.
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:udXODOJOGHA.3276@.TK2MSFTNGP09.phx.gbl...
> In this case, a DDL trigger -- in my mind at least -- is for logging
> and/or rolling back the change to the table.
> What were you expecting to do to the table directly while in the scope of
> the trigger?
>
>
> "Joe L" <jjj@.lll.com> wrote in message
> news:etW5zLJOGHA.3888@.TK2MSFTNGP12.phx.gbl...
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment