Partilhar via


Generate SQL Server Scripts Wizard (Choose Script Options Page)

Use this page to choose scripting options.

Options

Specify database scripting options by selecting from the available settings in the box to the right of each option. The defaults specified on this page are set when SQL Server is installed. Changes that are made to the options on the Scripting page of the Options dialog box also change the defaults for the Generate SQL ServerScripts Wizard. To access this dialog box, on the Tools menu, click Options, and then click Scripting.

General

  • Ansi Padding
    Adds the SET ANSI_PADDING ON statement before and after each CREATE TABLE statement. Default is True. For more information, see SET ANSI_PADDING.
  • 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.
  • Include system constraint names
    Includes system generated constraint names to enforce declarative referential integrity. Default is False. For more information, see REFERENTIAL_CONSTRAINTS (Transact-SQL).
  • Script Collation
    Includes collation information in the script. Default is False. For more information, see Working with Collations.
  • Script Create
    Includes CREATE statements for each object. Default is True.
  • 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 Drop
    Includes DROP statements for each object. Default is False.
  • Script for Server Version
    Creates a script that can be run on the selected version of SQL Server. Features new to SQL Server 2005 cannot be scripted for earlier versions. Some scripts 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 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 Script statistics and histograms settings, also creates histogram information. Default is Do not script statistics. For more information, see CREATE STATISTICS (Transact-SQL).
  • Script USE DATABASE
    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
    Includes full-text indexes for each table or indexed view to the script. Default is False. For more information, see CREATE FULLTEXT INDEX (Transact-SQL).
  • Script Indexes
    Adds clustered, nonclustered, and XML indexes for each table or indexed view to the script. Default is False. For more information, see CREATE INDEX (Transact-SQL).
  • Script Primary Keys
    Adds 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
    Adds 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
    Adds 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.

Change History

Release History

12 December 2006

New content:
  • Added the Ansi Padding, Include system constraint names, Script Create, Script Drop, and Script VarDecimal Options options.

17 July 2006

New content:
  • Added additional information about the options.

See Also

Other Resources

Documenting and Scripting Databases

Help and Information

Getting SQL Server 2005 Assistance