Exporting and Importing SQL Scripts

You can transfer scripts from your current Script Repository to a Script Repository in a different workspace by using the Export and Import tasks. Exported scripts are encoded in a single file on your local file system. Once exported, you then log in to another workspace and import the file. During import, the file is run to re-create the scripts in the current Script Repository.

By default, the Export SQL Scripts page lists all scripts in the Script Repository created by the current user. There are two panes on the Export SQL Scripts page, the Scripts pane and the Scripts to Export pane. You use the Scripts pane to select scripts to export. Then, you use the Scripts to Export pane to finalize the scripts to export, to choose a name for the export script, and to save the selected scripts in the export script on your local file system. You use the Import Scripts pane to select the export script containing the scripts to import.

Topics:

Copying Scripts to an Export Script

To copy scripts to an export script:

  1. On the Workspace home page, click SQL Workshop and then SQL Scripts.

    The SQL Scripts page appears.

  2. On the Tasks list, click Export.

    The Export SQL Scripts page appears.

  3. Click the check box for each of the scripts you want to export. The check boxes display on the left side adjacent to the script name. To select all displayed scripts for export, click the column head check box.

  4. Click Add to Export to create a list of scripts to be added to the export script.

    The selected scripts are added to the list of scripts in the Scripts to Export pane.

  5. Enter a name for the export script in the File Name field.

    The default script name is workspace_name_script.sql.

  6. Click Export All to export the scripts to the export script.

    You are prompted to enter the directory where you want to save the export script.

About the Scripts Pane

In the Scripts pane you can:

  • Search for a script. Enter a script name or partial name in the Find field and click Go. To view all scripts, leave the Find field blank, select - All Users - from the Owner list and click Go. You control how many rows display by making a selection from the Rows list.

  • Cancel the export. Click Cancel to return to the SQL Scripts page without exporting any scripts, or to return to the SQL Scripts page after saving an export script.

  • Selecting scripts to export. Click Add to Export to add scripts to the export script. Scripts added to the export script are no longer listed in the Script pane, but appear in the Scripts to Export pane.

  • Sort scripts. Click a column heading to sort the listed scripts by that column.

About the Scripts to Export Pane

In the Scripts to Export pane you can:

  • Rename the export script. Enter a name for the export script in the File Name field or leave the default script name.

  • Remove scripts. Click the check box adjacent to the scripts you want to remove f and click Remove Checked. Scripts removed are no longer listed in the Scripts to Export pane, but appear in the Scripts pane.

  • Save the export script. Click Export All to save the export script to your local file system. You are prompted to enter the directory where you want to save the export script.

Importing Scripts from an Export Script

To import scripts from an export script:

  1. On the Workspace home page, click SQL Workshop and then SQL Scripts.

    The SQL Scripts page appears.

  2. On the Tasks list, click Import.

    The Import Scripts pane appears. See "About the Import Scripts Pane".

  3. Enter the name and path to the export script you want to import to the Script Repository, or click Browse to locate the export script you want to import.

  4. Click Next to list the scripts in the export script.

    The Action column indicates whether the imported script is new, or whether it replaces an existing script of the same name.

  5. Click Import Script(s) to import the listed scripts into the current Script Repository.

    The SQL Scripts page appears listing the imported scripts.

About the Import Scripts Pane

In the Import Scripts pane you can:

  • Enter the export script. Enter the name and path of the script to import in the Import file field, or click Browse to locate the script.

  • Cancel the import. Click Cancel to return to the SQL Scripts page without importing scripts.

  • Proceed with the import. Click Next to import the scripts in the specified export script. You can review the listed scripts to import.

  • Choose another export file. Click Previous to return to the Import Scripts file selection page to choose a different export script.