Options (SQL Server Object Explorer/Scripting Page)

Use this page to set scripting options that apply to the following commands on object context menus in Object Explorer:

  • Edit commands for user tables and views.

  • Script <object> as commands for user-created objects.

  • Modify command for user-created objects.

  • This page also sets the scripting option defaults for the Generate SQL Server Script Wizard.

Remarks

The Edit and Modify commands might produce results that are different from the Script <object> as command for the same option setting. The Edit and Modify commands are designed to modify objects in the current database during a Query Editor session. The Script <object> as command is designed to generate a script so that it can be used later to create objects.

Options

Specify scripting options by selecting from the available settings in the list to the right of each option.

General Scripting Options

  • Delimit individual statements
    Separates individual Transact-SQL statements by using a batch separator. To change the default batch separator for Query Editor, select Tools/Options/Query Execution/SQL Server/General/Batch separator. Default is False. For more information, see GO (Transact-SQL) and Batches.

  • Include descriptive headers
    Adds descriptive comments to the script by separating the script into sections for each object. Default is True. For more information, see /*...*/ (Comment) (Transact-SQL).

  • Include vardecimal options
    Includes the vardecimal storage options. Default is False. For more information, see Storing Decimal Data As Variable Length and sp_db_vardecimal_storage_format (Transact-SQL).

  • Script change tracking
    Includes change tracking information in the script.

  • Script for server version
    Creates a script that can be run on the selected version of SQL Server. Features that are new in SQL Server 2005 cannot be scripted for earlier versions. Some scripts that are created for SQL Server 2005 cannot be executed on servers that are running on an earlier version of SQL Server, or on a database that has an earlier database compatibility level setting. Default is SQL Server 2005.

  • Script full-text catalogs
    Includes a script for full-text catalogs. Default is False. For more information, see CREATE FULLTEXT CATALOG (Transact-SQL).

  • Script USE <database>
    Adds the USE DATABASE statement to the script to create database objects in the context of the current Object Explorer database. When the script is expected for use in a different database, select False to omit. Default is True. For more information, see USE (Transact-SQL).

Object Scripting Options

  • Generate script for dependent objects
    Generates a script for additional objects that are required when the script for the selected object is executed. Default is False. For more information, see Understanding SQL Dependencies.

  • Include If NOT EXISTS clause
    Includes a statement to check that each object does not exist in the database before trying to create the object. Default is False. For more information, see IF...ELSE (Transact-SQL) and EXISTS (Transact-SQL).

  • Schema qualify object names
    Qualifies object names with the object schema. Default is False. For more information, see Schemas (Database Engine).

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

  • Script permissions
    Includes permissions on database objects in the script. Default is True. For more information, see Permissions (Database Engine).

Table/View Options

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

  • Convert user-defined data types to base types
    Converts user-defined data types to the base types from which they were created. Use True when the source database user-defined data types do not exist in the database where the script will be run. Use False to keep the user-defined data types. Default is False. For more information, see CREATE TYPE (Transact-SQL).

  • Generate SET ANSI PADDING commands
    Adds the SET ANSI_PADDING statement before and after each CREATE TABLE statement. Default is True. For more information, see SET ANSI_PADDING (Transact-SQL).

  • Include collation
    Includes collation in column definition. Default is True. For more information, see Working with Collations.

  • Include IDENTITY property
    Includes definitions for IDENTITY seed and IDENTITY increment. Default is True. For more information, see IDENTITY (Property) (Transact-SQL).

  • Schema qualify foreign key references
    Adds the schema name to table references for FOREIGN KEY constraints. Default is True. For more information, see Schemas (Database Engine).

  • Script bound defaults and rules
    Includes the sp_bindefault and sp_bindrule binding stored procedure calls. Default is True. For more information, see sp_bindefault (Transact-SQL) and sp_bindrule (Transact-SQL).

  • Script CHECK constraints
    Adds CHECK constraints to the script. Default is True.

  • Script defaults
    Includes column default values in the script. Default is False. For more information, see CREATE DEFAULT (Transact-SQL).

  • Script file groups
    Specifies the filegroup in the ON clause for table definitions. Default is False. For more information, see CREATE TABLE (Transact-SQL).

  • Script foreign keys
    Includes FOREIGN KEY constraints in the script. Default is False.

  • Script full-text indexes
    Includes full-text indexes in the script. Default is False. For more information, see CREATE FULLTEXT INDEX (Transact-SQL).

  • Script indexes
    Includes clustered, nonclustered, and XML indexes in the script. Default is True. For more information, see CREATE INDEX (Transact-SQL).

  • Script partition schemes
    Includes table partitioning schemes in the script. Default is False. For more information, see CREATE PARTITION SCHEME (Transact-SQL).

  • Script primary keys
    Includes PRIMARY KEY Constraints in the script. Default is True.

  • Script statistics
    Includes user-defined statistics in the script. Default is False. For more information, see CREATE STATISTICS (Transact-SQL).

  • Script triggers
    Include triggers in the script. Default is False. For more information, see CREATE TRIGGER (Transact-SQL).

  • Script unique keys
    Includes UNIQUE Constraints in the script. Default is False.

  • Script view columns
    Declares view columns in view headers. Default is False. For more information, see CREATE VIEW (Transact-SQL).

  • ScriptDriIncludeSystemNames
    Includes system generated constraint names to enforce declarative referential integrity. Default is False. For more information, see REFERENTIAL_CONSTRAINTS (Transact-SQL).