Compare and synchronize scripts folders

A scripts folder is a set of scripts that represent a database schema and (optionally) data. The scripts folder can be used for:

Create a scripts folder

There are two ways to create a new scripts folder via Schema Compare.

The first way is to create a scripts folder from the Database menu > Tasks > Create Scripts Folder or Snapshot.

Database menu

1. In the Create Scripts Folder or Snapshot dialog that appears, specify the type of the source object, the required connection, database name, output type (Scripts Folder), and the path for your scripts folder to be saved to.

2. Optional: You can select the check box to Include data. You can also go to Scripts Folder Structure and specify the structure for your scripts folder and file name templates.

Create Scripts Folder or Snapshot

3. Once you configure everything, click Create. As a result, all database objects will be created.

The second way is to create a scripts folder through the synchronization of the required database with an empty folder.

1. Click New Schema Comparison on the menu to open the wizard.

2. In Source, select the Database type, then select the required connection and database.

3. In Target, select the Scripts Folder type and set a path to an empty folder in Database scripts folder.

4. Click Compare.

New Schema Comparison

When the comparison is completed, you will be able to specify the objects that will be added to the scripts folder (or select all of them).

5. Invoke the synchronization wizard, select Update the scripts folder, and click Synchronize.

Schema Synchronization Wizard

Compare and synchronize scripts folders

When comparing and synchronizing scripts folders either as a target or a source, a synchronization script is created. It can be saved to a file or opened in an internal editor.

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

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

Scripts folder synchronization issues

  • Certificates, symmetric keys, and asymmetric keys are not supported when you use a scripts folder as a data source.

  • 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.

  • We recommend you enable the Ignore spaces in object names and Ignore white spaces options on the Options tab when you use a scripts folder as a data source. The fact is that SQL Server doesn’t always process white spaces correctly at the beginning and end of the object definition. There can be issues for objects such as views, stored procedures and functions, triggers, user types, defaults, and rules.