Advanced Scripting

Advanced Scripting Dialog

Advanced Scripting exposes all the new scripting techniques introduced by recent SQL server client tools components and can be used to automatically generate drop and create scripts in the appropriate dependency order from underlying databases and servers, for all database and server objects.

The Advanced Scripting dialog can be used in two ways:

1. When working on code packages, you can right-click the package node and then select Add SQL Script → From Advanced Scripting. Using this option will allow you to generate SQL scripts using the dialog, and when you are done, the scripts will be automatically placed in the code package in the appropriate dependency order.

2. You can also invoke the Advanced Scripting dialog independently of a code package, to generate one or more scripts for your database objects. To do so, go to Tools → Advanced Scripting. After you select the objects that you wish to script and press OK in the dialog, scripts will be created in the SQL editor. If you select the Export option, scripts will be exported to the local file system.

The Advanced Scripting dialog allows you to generate scripts easily. Moreover, you can also see the content of the scripts refresh and change in real-time as you select different scripting options or database objects in the dialog (please refer to the progress bar at the bottom left corner of the dialog when selecting objects or scripting options). Furthermore, special attention should be given to the following scripting options in the dialog:

Script to a Single File (default = false) - when this option is set to true, a single file will be generated for all scripted objects, for all CREATE and DROP statements.

Transaction/Error Handling (default = false) - this option mandates scripting to a single file. When this option is selected, all SQL statements in the script are placed under a single transaction, which in turn provides auto-rollback capabilities when deployed against a target database. In other words, when you set the value of this option to true and place the generated script in a code package (for example), if any errors occur during package deployment, all changes performed in the script will be automatically rolled back by the SQL server. Similarly, if you run the produced script against a single database from the editor, errors that occur during execution will prompt a rollback of all script changes.

Group Drops Before Creates (under the Advanced tab) - when this option is set to true (which is the default), all DROP statements will be grouped together before any CREATE statements, to allow you to run your scripts repeatedly and in the correct order.

© 2001-2018 JNetDirect, Inc. All Rights Reserved.