The topic describes how to create a scripts folder by using the Create Scripts Folder or Snapshot dialog of dbForge Studio for SQL Server or by using the command line.
Tip
You can also use the Generate Scripts Wizard to script table data and/or objects into a single file.
A scripts folder is a set of object creation scripts that represent a database schema and, optionally, data. Each database object is represented by an individual script file. The files are grouped by object type and stored in user-defined subfolders.
Note
The Scripts folder feature is available only in the Enterprise edition of dbForge Studio for SQL Server.
A scripts folder contains the following components:
CREATE statements for the objects in that category.INSERT statements for static data, organized by table.ALTER DATABASE statements that apply to the database as a whole.1. Open the Create Scripts Folder or Snapshot dialog in one of these ways:
2. Under Source, configure the source settings:
2.1. In Type, select the data source type.
2.2. Depending on the data source, specify its details.
3. Under Target, configure the destination settings:
3.1. In Type, select Scripts Folder.
3.2. In Path, specify the full path to the folder where the scripts folder will be stored, or click the ellipsis (…) and select the existing folder.
3.3. Optional: Select Include data to insert static data.
Note
The Include data checkbox is available only if the Database type is selected as the source.
4. To change the default folder and file name structure for scripts:
4.1. Click Scripts Folder Structure.
The Scripts Folder Structure dialog opens. All objects are selected by default.
4.2. Use the checkboxes:
4.3. Click OK.

5. Click Create.

You can select the following data source types as the source:
When you select Database as the source type, configure the settings:
When you select Scripts Folder as the source type, in Database scripts folder, specify the full path to the scripts folder, select the previously added scripts folder or click the ellipsis (…) and add the existing folder.
When you select Snapshot as the source type, in Snapshot, select the previously added snapshot or click the ellipsis (…) and add the existing snapshot (.snap).
The table describes the values from the grid of the Scripts Folder Structure dialog.
| Column | Description |
|---|---|
| Type | Specifies the database object type, such as Table, View, or Procedure. To include the object type in script generation, select the checkbox for the required type. To exclude the object type, clear the corresponding checkbox. |
| Subfolder name | Defines the folder structure where scripts are saved. To generate a subfolder for that object type, select the checkbox for the required subfolder. Otherwise, clear the corresponding checkbox. |
| Name | Defines the file name format for each script. |
| Extension | Specifies the file extension of the generated script. The default value is .sql. |
The table describes the available literals used for folders or file names.
| Variable | Description |
|---|---|
| $database$ | Inserts the current database name. |
| $schema$ | Inserts the schema name, for example, dbo. |
| $object$ | Inserts the object name, for example, Customers. |
| $type$ | Inserts the object type, for example, Table or View. |
When you create a scripts folder of the Bikestores database with this configuration:
TableTables\$schema$.$object$.sqldbForge Studio will create the following scripts:
Bikestores\Tables\dbo.Customers.sql
Bikestores\Tables\dbo.Orders.sql
You can create a command-line execution .bat file to automate or schedule the scripts folder creation.
To create a command-line execution file:
1. In the lower-left corner of the Create Scripts Folder or Snapshot dialog, click Save Command Line.
2. In the Command line execution file settings dialog, configure the command-line settings.
3. Click Validate to verify the settings.
4. Click Save.

1. Open Command Prompt (CMD).
2. Specify the /scriptsfolder operation to create a scripts folder and replace the parameters and arguments with your actual data:
"C:\Program Files\Devart\dbForge Studio for SQL Server\dbforgesql.com" /scriptsfolder /connection:"Data Source=<server_connection>;Integrated Security=False;User ID=<user_name>" /database:<database_name> /path:"<path_to_scripts_folder>"
where:
C:\Program Files\Devart\dbForge Studio for SQL Server\dbforgesql.com – The full path to the default installation folder of dbForge Studio for SQL Server.<server_connection> – The server connection where the source database resides.<user_name> – The username you connect to the server.<database_name> – The database based on which the scripts folder is created.<path_to_scripts_folder> – The full path to the scripts folder.Tip
To include static data, specify
Yesfor/includedata. If you don’t want to decrypt data, specifyNofor/decrypt.
3. Press Enter.
The table provides the command-line arguments (switches) you can use in the script to create a scripts folder from the command line.
| Argument | Description |
|---|---|
/connection |
Specifies a connection string. Usage: /connection:<connection_string> |
/database |
Specifies the database to create a scripts folder. Usage: /database:<database_name> |
/decrypt |
Defines whether to decrypt source objects. Usage: /decrypt:<value>To turn the option on, specify Yes, Y, On, True, or T.To turn it off, specify No, N, Off, False, or F. |
/password |
Specifies the server password. Usage /password:<yourpassword>The switch overrides the password specified in the connection string. |
/path |
Specifies the full path to the scripts folder. Usage: /path:<folder_path> |
/includedata |
Defines whether to include data. Usage: /includedata:[value]To turn the option on, specify Yes, Y, On, True, or T.To turn it off, specify No, N, Off, False, or F. |
/clearfolder |
Removes all existing files and subfolders inside that directory before generating new scripts. Usage: /clearfolder:[value]To turn the option on, specify Yes, Y, On, True, or T.To turn it off, specify No, N, Off, False, or F. |
Tip
To see a quick help on the switches available for the
/snapshotoperation, enter the following:"C:\Program Files\Devart\dbForge Studio for SQL Server\dbforgesql.com" /snapshot /?