ScriptType Property
后续版本的 Microsoft SQL Server 将删除该功能。请避免在新的开发工作中使用该功能,并着手修改当前还在使用该功能的应用程序。
The ScriptType and Script2Type properties configure the Transact-SQL script generated and used to copy database schema in a transfer of schema from one database to another.
语法
object
.ScriptType [= value]
Parts
object
An expression that evaluates to an object in the Applies To list.value
A long integer that specifies script generation options as described in Settings.
Data Type
Long, enumerated
Modifiable
Read/write
Prototype (C/C++)
HRESULT GetScriptType(SQLDMO_SCRIPT_TYPE* pRetVal);
HRESULT SetScriptType(SQLDMO_SCRIPT_TYPE NewValue);
Settings
Constant |
Value |
Description |
---|---|---|
SQLDMOScript_Bindings |
128 |
Generates sp_bindefault and sp_bindrule statements. It applies only if scripting references a Microsoft SQL Server table. |
SQLDMOScript_/ClusteredIndexes |
8 |
Generates Transact-SQL defining clustered indexes. It applies only when scripting references a SQL Server table. |
SQLDMOScript_/DatabasePermissions |
32 |
Generates Transact-SQL database permission-defining script. Database permissions grant or deny statement execution rights. |
SQLDMOScript_DRI_All |
532676608 |
All values are defined as SQLDMOScript_DRI_... are combined using an OR logical operator. |
SQLDMOScript_DRI_/AllConstraints |
520093696 |
SQLDMOScript_DRI_Checks, SQLDMOScript_DRI_Defaults, SQLDMOScript_DRI_/ForeignKeys, SQLDMOScript_DRI_/PrimaryKey, and SQLDMOScript_DRI_/UniqueKeys are combined using an OR logical operator. |
SQLDMOScript_DRI_AllKeys |
469762048 |
SQLDMOScript_DRI_/ForeignKeys, SQLDMOScript_DRI_/PrimaryKey, and SQLDMOScript_DRI_/UniqueKeys are combined using an OR logical operator. |
SQLDMOScript_DRI_Checks |
16777216 |
The generated script creates column-specified CHECK constraints. It directs scripting if declarative referential integrity establishes dependency relationships. It applies only if scripting references a SQL Server table. |
SQLDMOScript_DRI_Clustered |
8388608 |
The generated script creates clustered indexes. It directs scripting if declarative referential integrity establishes dependency relationships. It applies only if scripting references a SQL Server table. |
SQLDMOScript_DRI_Defaults |
33554432 |
The generated script includes column-specified defaults. It directs scripting if declarative referential integrity establishes dependency relationships. It applies only if scripting references a SQL Server table. |
SQLDMOScript_DRI_/ForeignKeys |
134217728 |
The generated script creates FOREIGN KEY constraints. It directs scripting if declarative referential It applies only if scripting references a SQL Server table. |
SQLDMOScript_DRI_/NonClustered |
4194304 |
The generated script creates nonclustered indexes. It directs scripting if declarative referential integrity establishes dependency relationships. It applies only if scripting references a SQL Server table. |
SQLDMOScript_DRI_/PrimaryKey |
268435456 |
The generated script creates PRIMARY KEY constraints. It directs scripting if declarative referential integrity establishes dependency relationships. It applies only if scripting references a SQL Server table. |
SQLDMOScript_DRI_/UniqueKeys |
67108864 |
The generated script creates candidate keys defined using a unique index. It directs scripting if declarative referential integrity establishes dependency relationships. It applies only if scripting references a SQL Server table. |
SQLDMOScript_/DRIWithNoCheck |
536870912 |
If using SQLDMOScript_DRI_Checks or SQLDMOScript_DRI_/ForeignKeys, the generated script includes the WITH NOCHECK clause optimizing constraint creation. It applies only if scripting references a SQL Server table. |
SQLDMOScript_Drops |
1 |
Generates Transact-SQL to remove referenced component. The script tests for existence of a prior attempt to remove the component. |
SQLDMOScript_/IncludeHeaders |
131072 |
The generated script is prefixed with a header containing the date and time of generation and other descriptive information. |
SQLDMOScript_IncludeIfNotExists |
4096 |
The Transact-SQL creating a component is prefixed by a check for existence. When the script is executed, the component is created only if a copy of the named component does not exist. |
SQLDMOScript_Indexes |
73736 |
SQLDMOScript_/ClusteredIndexes, SQLDMOScript_/NonClusteredIndexes, and SQLDMOScript_DRIIndexes are combined using an OR logical operator. It applies to both table and view objects. |
SQLDMOScript_NoIdentity |
1073741824 |
The generated Transact-SQL statements do not include definition of identity property, seed, and increment. It applies only if scripting references a SQL Server table. |
SQLDMOScript_/NonClusteredIndexes |
8192 |
Generates Transact-SQL defining nonclustered indexes. It applies only if scripting references a SQL Server table. |
SQLDMOScript_/ObjectPermissions |
2 |
Includes Transact-SQL permission-defining statements when scripting database objects. |
SQLDMOScript_OwnerQualify |
262144 |
Object names in Transact-SQL that are generated to remove an object are qualified by the owner of the referenced object. Transact-SQL qualifies the object name using the current object owner. |
SQLDMOScript_Permissions |
34 |
SQLDMOScript_/ObjectPermissions and SQLDMOScript_/DatabasePermissions are combined using an OR logical operator. |
SQLDMOScript_PrimaryObject |
4 |
Generates Transact-SQL creating the referenced component. |
SQLDMOScript_/TimestampToBinary |
524288 |
When scripting object creation for a table or user-defined data type, converts specification of timestamp data type to binary(8). |
SQLDMOScript_TransferDefault |
422143 |
Default. SQLDMOScript_PrimaryObject, SQLDMOScript_Drops,SQLDMOScript_Bindings, SQLDMOScript_/ClusteredIndexes, SQLDMOScript_/NonClusteredIndexes, SQLDMOScript_Triggers, SQLDMOScript_ToFileOnly, SQLDMOScript_Permissions, SQLDMOScript_/IncludeHeaders, SQLDMOScript_Aliases, SQLDMOScript_IncludeIfNotExists, and SQLDMOScript_OwnerQualify are combined using an OR logical operator. |
SQLDMOScript_Triggers |
16 |
Generates Transact-SQL defining triggers. It applies only if scripting references a SQL Server table. |
SQLDMOScript_/UDDTsToBaseType |
1024 |
Converts specification of user-defined data types to the appropriate SQL Server base data type. It applies only if scripting references a SQL Server table. |
SQLDMOScript_/UseQuotedIdentifiers |
-1 |
Uses quotation mark characters to delimit identifier parts when scripting object names. |
注释
Use the AddObject and AddObjectByName methods of the Transfer object to build a list of SQL Server components copied from one database to another. After the list is built, configure component transfer using the ScriptType and Script2Type properties.