Scripts Tutorial

The Before and After Scripts have been provided just in case you need something that Database Schema Designer does not provide.   They are SQL scripts that you can write yourself that will run either before or after the main SQL that DBSD creates.   This tutorial will show you how to easily create and maintain these scripts.

  1. Open the Scripts screen.
    There are a number of methods to open the Scripts screen.   Choose the one you are most comfortable with.
    • Press "Ctrl + F1".
    • Click "Schema -> Manage -> Before/After Scripts" on the main menu.
      Manage Scripts
    • Right Click the Schema and select "Manage -> Before/After Scripts".
      Manage Scripts
  2. Click the Before or After Script tab depending on which one you want to work with.   The 'Before Scripts' are run prior to the execution of DBSD's SQL and 'After Scripts' are run subsequent to the execution of DBSD's SQL.
    Before / After
  3. Type the SQL that you need.   We recommend that you place the keyword GO on it's own line after each SQL command.   Failing to do so may result in errors.
  4. Click the  Validate Syntax  button to log in to your Server and validate the Script syntax.  (Not Required)
  5. Click OK to submit your changes.
    - OR -
    Click Cancel to discard your settings.
An After Script is the perfect place to execute Insert Statements to populate your Tables with data.   To make your life easier, DBSD provides an easy method to create your Insert Statements.   Prior to opening the Script's editor, right-click any Table(s) and choose "Copy Special->Insert Statement" from the menu.   DBSD has just copied Insert Statement Templates to the Clipboard that you can paste into the After Script editor.

* There are a few keyboard shortcuts available for screens that have direct SQL entry.   See SQL Quick Tips