SQL DDL trigger

  • I have just starting using MS SQL Server.

    I want to create a DDL trigger. The idea is as follows:

    I have a table named DefaultValues with these columns:

    DefaultValueID,

    TableName,

    ColumnName,

    ColumnValue

    The table is used to store default values for other tables

    To obtain integrity the idea is to have a trigger(after update) to catch if a column in a table changes name and then change the values in the ColumnName accordingly.

    Can some of you clever people assist me in my first efforts to create such a trigger

  • Here is some info with examples (sample code) of what I think you want to accomplish.

    http://beyondrelational.com/modules/2/blogs/43/posts/10196/who-created-a-table-ddl-triggers-in-sql-server-2008.aspx

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • You know, You could also just use use a View that remaps the Table Default information already stored in the database's metadata and presents it in the same format as your table. No triggers would be needed then.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply