locked
Add database items using a macro based on table selected in Schema View RRS feed

  • Question

  • I have a SQL 2008 DB project in VS2010.  The table schema is visible in "Schema View" and the associated files are (automatically) organized nicely in the Solution Explorer.

    I am wanting to automate creating TimeStamp fields, constraints, and triggers for selected tables using a macro (or other method).

    1) add fields (tsModified, tsModifiedApp, tsModifiedHost, tsModifiedUser)
    2) add default constraints
    3) add trigger

    The object names are based on the schema and table:

    Default constraints:
    DF_<schema>_<table>_tsModified
    DF_<schema>_<table>_tsModifiedApp
    DF_<schema>_<table>_tsModifiedHost
    DF_<schema>_<table>_tsModifiedUser

    Trigger:
    t_<schema>_<table>_u

    The corresponding files are to be placed in the correct directory in the Solution Explorer.

    thank you.


    • Edited by Rogge Friday, July 27, 2012 3:57 PM clarification of my chicken scratch
    Friday, July 27, 2012 3:56 PM

Answers

All replies