Share via

Generate SQL Server Scripts Wizard (Choose Script Options Page)

Use this page to choose scripting options.


Specify database scripting options by selecting from the available settings in the list box to the right of each option. The options are applied globally to the objects that are being scripted.


  • Append to File
    Adds this script to the bottom of an existing script, specified on the Output Options page. Default is False, which indicates the new script will overwrite a previous script.

  • Continue Scripting on Error
    True indicates scripting stops when an error occurs. When False, scripting continues. Default is False.

  • Convert UDDTs to Base Types
    When True, user-defined data types are converted into the base data types that under are used to create the user-defined data type. Use True when the user-defined data type does not exist in the database where the script will be run. Default is False, which indicates that user-defined data types will be scripted using the UDDT.

  • Generate Script for Dependent Objects
    Generates a script for any object that is required to be present when the script for the selected object is executed. Default is True.

  • Include Descriptive Headers
    When True, descriptive comments are added to the script separating the script into sections for each object. Default is False.

  • Include If NOT EXISTS
    When True, script includes a statement to check whether the object already exists in the database, and does not try to create a new object if the object already exists. Default is True.

  • Script Behavior
    The default option, Generate CREATE statements only, generates a script to create the objects. Generate DROP statements only creates scripts that drop the selected objects. This wizard cannot generate a script that first drops an object and then creates a new version of the object.

  • Script Collation
    Includes collation information in the script. Default is False. For more information, see Working with Collations.

  • Script Database Create
    Includes the CREATE DATABASE statement in the script. Default is False.

  • Script Defaults
    Includes default values for columns, when present in the original object. Default is True. For more information, see CREATE DEFAULT (Transact-SQL).

  • Script Extended Properties
    Includes extended properties in the script is the object has extended properties. Default is True. For more information, see Using Extended Properties on Database Objects.

  • Script for Server Version
    Creates a script that can be run on the selected version of SQL Server. Features new to a version cannot be scripted for earlier versions.

  • Script Logins
    When the object to be scripted is a database user, use the Script Logins option to create the logins on which the user depends. Default is False.

  • Script Object-Level Permissions
    Includes scripts to set permission on the objects in the database. Default is False.

  • Script Owner
    When True, CREATE statements include the current object owner or schema. When False, CREATE statements do not include the object owner or schema, and objects that are created by the script will use the default value for the user that is executing the script. Default is True. For more information, see User-Schema Separation.

  • Script Statistics
    When set to Script Statistics, includes the CREATE STATISTICS statement to re-create statistics on the object. The Create statistics and histograms option, also creates histogram information. Default is Do not script statistics. For more information, see CREATE STATISTICS (Transact-SQL).

    Adds the USE DATABASE statement to the script. To make sure database objects are created in the correct database, include the USE DATABASE statement. When the script is expected to be used in a different database, select False to omit the USE DATABASE statement. Default is False. For more information, see USE (Transact-SQL).

Table/View Options

The following options apply only to scripts for tables or views.

  • Script Check Constraints
    Adds CHECK constraints to the script. Default is True. CHECK constraints require data entered into a table to meet some specified condition. For more information, see CHECK Constraints.

  • Script Foreign Keys
    Adds foreign keys to the script. Default is True. Foreign keys indicate and enforce relationships between tables. For more information, see FOREIGN KEY Constraints.

  • Script Full-Text Indexes
    Scripts the creation of full-text indexes. Default is False.

  • Script Indexes
    Scripts the creation of indexes on the tables. Default is True. Indexes help you find data quickly.

  • Script Primary Keys
    Scripts the creation of primary keys on the tables. Default is True. Primary keys uniquely identify each row of a table. For more information, see PRIMARY KEY Constraints.

  • Script Triggers
    Scripts the creation of triggers on the tables. Default is True. Triggers cause actions to occur when data is modified. For more information, see Understanding DML Triggers.

  • Script Unique Keys
    Scripts the creation of unique keys on the tables. Unique keys prevent duplicate data from being entered. Default is True. For more information, see UNIQUE Constraints.