选项(SQL Server 对象资源管理器 -“脚本”页)Options (SQL Server Object Explorer - Scripting Page)
08/01/2017
本文内容
适用于:Applies to: SQL ServerSQL Server(所有支持的版本)
SQL ServerSQL Server (all supported versions)
Azure SQL 数据库Azure SQL Database
Azure SQL 数据库Azure SQL Database
Azure SQL 托管实例Azure SQL Managed Instance
Azure SQL 托管实例Azure SQL Managed Instance
Azure Synapse AnalyticsAzure Synapse Analytics
Azure Synapse AnalyticsAzure Synapse Analytics
并行数据仓库Parallel Data Warehouse
并行数据仓库Parallel Data Warehouse适用于:Applies to:
SQL ServerSQL Server(所有支持的版本)
SQL ServerSQL Server (all supported versions)
Azure SQL 数据库Azure SQL Database
Azure SQL 数据库Azure SQL Database
Azure SQL 托管实例Azure SQL Managed Instance
Azure SQL 托管实例Azure SQL Managed Instance
Azure Synapse AnalyticsAzure Synapse Analytics
Azure Synapse AnalyticsAzure Synapse Analytics
并行数据仓库Parallel Data Warehouse
并行数据仓库Parallel Data Warehouse
使用此页可设置脚本选项,以应用于对象资源管理器中对象上下文菜单上的以下命令: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 as commands for user-created objects.
用于用户创建对象的“修改”命令。Modify command for user-created objects.
本页也可用于设置“生成 SQL Server 脚本向导”的脚本选项默认值。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 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 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.
备注
列出的默认设置仅适用于“编写整个数据库及所有数据库对象的脚本”选项,并且在使用“选择特定数据库对象”选项时,此设置可能会有变化。The default settings listed only apply to the Script entire database and all database objects option and may vary when using the Select specific database objects option.
常规脚本选项General scripting options
分隔各条语句Delimit individual statements
使用批处理分隔符分隔各条 Transact-SQLTransact-SQL 语句。Separates individual Transact-SQLTransact-SQL statements by using a batch separator. 若要更改 查询编辑器,选择“工具”/“选项”/“查询执行”/“SQL Server”/“常规”/“批处理分隔符”。To change the default batch separator for Query Editor, select Tools/Options/Query Execution/SQL Server/General/Batch separator. 默认值为 False。Default is False. For more information, see GO (Transact-SQL).
包含说明性标头Include descriptive headers
通过将每个对象的脚本分隔为多个部分以向脚本添加说明性注释。Adds descriptive comments to the script by separating the script into sections for each object. 默认值为 True。Default is True.
包括启用 vardecimal 压缩Include enabling vardecimal compression
包含 vardecimal 存储选项。Includes the vardecimal storage options. 默认值为 False。Default is False.
编写更改跟踪的脚本Script change tracking
将更改跟踪信息包含到脚本中。Includes change tracking information in the script.
编写全文目录脚本Script full-text catalogs
包含用于全文目录的脚本。Includes a script for full-text catalogs. 默认值为 False。Default is False.
脚本 USEScript USE
将 USE DATABASE 语句添加到脚本,可在当前 对象资源管理器 数据库的上下文中创建数据库对象。Adds the USE DATABASE statement to the script to create database objects in the context of the current Object Explorer database. 如果希望该脚本可在其他数据库中使用,请选择 False 以忽略该选项。When the script is expected for use in a different database, select False to omit. 默认值为 True。Default is True. For more information, see USE (Transact-SQL).
对象脚本选项Object scripting options
检查对象是否存在 在删除或更改前检查是否存在具有给定名称的对象,或者在创建前检查是否不存在具有给定名称的对象。Check for object existence Check that an object with the given name exists before dropping or altering or that an object with the given name does not exist before creating.
生成依赖对象的脚本Generate script for dependent objects
为在执行所选对象的脚本时需要的附加对象生成脚本。Generates a script for additional objects that are required when the script for the selected object is executed. 默认值为 False。Default is False.
架构限定对象名称Schema qualify object names
使用对象架构限定对象名称。Qualifies object names with the object schema. 默认值为 False。Default is False. 有关详细信息,请参阅 创建数据库架构。For more information, see Create a Database Schema.
脚本数据压缩选项 在脚本中包含数据压缩选项。Script data compression options Includes data compression options in the script. 默认值为 False。Default is False.
编写扩展属性脚本Script extended properties
如果对象具有扩展属性,则在脚本中包含扩展属性。Includes extended properties in the script if the object has extended properties. 默认值为 False。Default is False.
编写所有者脚本Script owner
在生成的脚本中包含所有者。Includes the owner in the generated script. 默认值为 False。Default is False.
编写权限脚本Script permissions
在脚本中包括数据库对象的权限。Includes permissions on database objects in the script. 默认值为 True。Default is True. 有关详细信息,请参阅 权限。For more information, see Permissions.
表/视图选项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. 将运行脚本的数据库中不存在源数据库用户定义数据类型时,请使用 True。Use True when the source database user-defined data types do not exist in the database where the script will be run. 使用 False 可以保留用户定义数据类型。Use False to keep the user-defined data types. 默认值为 False。Default is False. For more information, see CREATE TYPE (Transact-SQL).
生成 SET ANSI PADDING 命令Generate SET ANSI PADDING commands
将 SET ANSI_PADDING 语句添加在每条 CREATE TABLE 语句的前后。Adds the SET ANSI_PADDING statement before and after each CREATE TABLE statement. 默认值为 True。Default is True.
包含排序规则Include collation
在列定义中包含排序规则。Includes collation in column definition. 默认值为 True。Default is True.
包含 IDENTITY 属性Include IDENTITY property
包含 IDENTITY 种子和 IDENTITY 增量的定义。Includes definitions for IDENTITY seed and IDENTITY increment. 默认值为 True。Default is True.
架构限定外键引用Schema qualify foreign key references
将架构名称添加到 FOREIGN KEY 约束的表引用。Adds the schema name to table references for FOREIGN KEY constraints. 默认值为 True。Default is True.
绑定到脚本的默认值和规则Script bound defaults and rules
包括 sp_bindefault 和 sp_bindrule 绑定存储过程调用。Includes the sp_bindefault and sp_bindrule binding stored procedure calls. 默认值为 True。Default is True.
编写检查约束脚本Script CHECK constraints
将 CHECK 约束 添加到脚本中。Adds CHECK constraints to the script. 默认值为 True。Default is True.
编写默认值脚本Script defaults
在脚本中包含列默认值。Includes column default values in the script. 默认值为 False。Default is False.
编写文件组脚本Script file groups
在 ON 子句中为表定义指定文件组。Specifies the filegroup in the ON clause for table definitions. 默认值为 False。Default is False.
编写外键脚本Script foreign keys
默认值为 False。Default is False.
编写全文检索脚本Script full-text indexes
在脚本中包含全文检索。Includes full-text indexes in the script. 默认值为 False。Default is False.
编写索引脚本Script indexes
在脚本中包含聚集索引、非聚集索引和 XML 索引。Includes clustered, nonclustered, and XML indexes in the script. 默认值为 True。Default is True.
编写分区方案脚本Script partition schemes
在脚本中包含表分区方案。Includes table partitioning schemes in the script. 默认值为 False。Default is False.
编写主键脚本Script primary keys
默认值为 True。Default is True.
编写统计信息脚本Script statistics
在脚本中包含用户定义统计信息。Includes user-defined statistics in the script. 默认值为 False。Default is False.
编写触发器脚本Script triggers
在脚本中包含触发器。Include triggers in the script. 默认值为 False。Default is False.
编写唯一键脚本Script unique keys
默认值为 False。Default is False.
编写视图列脚本Script view columns
在视图页眉中声明视图列。Declares view columns in view headers. 默认值为 False。Default is False. For more information, see CREATE VIEW (Transact-SQL).
包括 dri 系统名称Include dri system names
包含系统生成的约束名称,以强制声明性引用完整性。Includes system generated constraint names to enforce declarative referential integrity. 默认值为 False。Default is False.
版本选项Version options
将脚本设置与源进行匹配 如果启用,则将生成的脚本的目标版本、引擎版本和引擎类型设置为要脚本化的对象的服务器的值。Match script settings to source If enabled the target version, engine edition and engine type of the scripts generated will be set to the values of the server the object being scripted. 这将禁用(并忽略)其他版本选项。This will disable (and ignore) the other version options.
数据库引擎版本的脚本 生成的脚本将面向指定的 引擎版本。Script for database engine edition Scripts generated will be targeted for the specified Engine Edition.
数据库引擎类型的脚本 生成的脚本将面向指定的 数据库引擎类型。Script for database engine type Scripts generated will be targeted for the specified Database Engine Type.
为服务器版本编写脚本Script for server version
生成的脚本将面向指定版本的 SQL ServerSQL Server。Scripts generated will be targeted for the specified version of SQL ServerSQL Server. 无法为早期版本编写 SQL ServerSQL Server 新增功能的脚本。Features that are new in SQL ServerSQL Server cannot be scripted for earlier versions. 某些为 SQL ServerSQL Server 创建的脚本无法在运行 SQL ServerSQL Server早期版本的服务器或具有早期 数据库兼容级别设置的数据库中运行。Some scripts that are created for SQL ServerSQL Server cannot be executed on servers that are running on an earlier version of SQL ServerSQL Server, or on a database that has an earlier database compatibility level setting.
另请参阅See also