Working with scripts folders

A scripts folder is a set of scripts that represent a database schema. The scripts folder can be used for:

  • Version-controlling databases
  • Comparing database schemas
  • Comparing databases on unconnected SQL Servers.

With Data Compare for SQL Server, you can create a scripts folder from an existing data source. You can do it in the New Data Comparison wizard when you set up the comparison.

Creating a scripts folder

To create a new scripts folder via Data Compare:

1. In the New Schema Comparison wizard, select Scripts folder either as a Source or a Target.

2. Click the New button.

Creating a new scripts folder

3. In the Create Scripts Folder or Snapshot dialog box that appears, specify a type of the object, you’re creating a scripts folder from, connection, the database name, the output file name, and the folder to save it to.

Scripts folder wizard

Note:

You can create a scripts folder from a database or another scripts folder.

By default, Data Compare decrypts encrypted objects. If you want to disable this option, click to unselect the checkbox next to this option. Enabling this option may result in slower performance.

Note:

If you create a scripts folder from another scripts folder, the decryption option is not available.

4. Click Create.

You can customize the scripts folder structure and file names templates. To do this, click the Scripts Folder Structure button. The Scripts Folder Structure dialog box is displayed, allowing you to specify the directories to save your database objects to.

Scripts folder structure

Comparing and synchronizing scripts folders

When comparing and synchronizing scripts folders either as the Target or the Source, a synchronization script is created. It can be saved to a file or opened in an internal browser.

When a scripts folder is selected as the Source, you can select to execute the synchronization script directly target database.

When a scripts folder is selected as the Target, you can select to update the scripts folder after synchronization.

Scripts folders synchronization issues

  • We recommend you to enable Ignore spaces in object names and Ignore trailing spaces options when using a scripts folder as a data source. That’s because SQL Server doesn’t always process white space and comments correctly at the beginning and end of the object definition for such objects as views, stored procedures, and rules.

  • When you select a scripts folder as a target data source, comments that are part of a table definition will be lost when the table is modified and the object creation script updated.