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]
Part | Description |
---|---|
object | Expression that evaluates to an object in the Applies To list |
value | Long integer specifying script generation options as described in Settings |
Constant | Value | Description |
---|---|---|
SQLDMOScript_Bindings | 128 | Generate sp_bindefault and sp_bindrule statements. Applies only when scripting references a Microsoft® SQL Server™ table. |
SQLDMOScript_ClusteredIndexes | 8 | Generate Transact-SQL defining clustered indexes. Applies only when scripting references a SQL Server table. |
SQLDMOScript_DatabasePermissions | 32 | Generate Transact-SQL database privilege defining script. Database permissions grant or deny statement execution rights. |
SQLDMOScript_DRI_All | 532676608 | All values defined as SQLDMOScript_DRI_... combined by using an Or. |
SQLDMOScript_DRI_AllConstraints | 520093696 | SQLDMOScript_DRI_ Checks, SQLDMOScript_DRI_ Defaults, SQLDMOScript_DRI_ ForeignKeys, SQLDMOScript_DRI_ PrimaryKey, and SQLDMOScript_DRI_ UniqueKeys combined by using a logical OR. |
SQLDMOScript_DRI_AllKeys | 469762048 | SQLDMOScript_DRI_ ForeignKeys, SQLDMOScript_DRI_ PrimaryKey, SQLDMOScript_DRI_ UniqueKeys combined by using a logical OR. |
SQLDMOScript_DRI_Checks | 16777216 | Generated script creates column-specified CHECK constraints. Directs scripting when declarative referential integrity establishes dependency relationships. Applies only when scripting references a SQL Server table. |
SQLDMOScript_DRI_Clustered | 8388608 | Generated script creates clustered indexes. Directs scripting when declarative referential integrity establishes dependency relationships. Applies only when scripting references a SQL Server table. |
SQLDMOScript_DRI_Defaults | 33554432 | Generated script includes column-specified defaults. Directs scripting when declarative referential integrity establishes dependency relationships. Applies only when scripting references a SQL Server table. |
SQLDMOScript_DRI_ForeignKeys | 134217728 | Generated script creates FOREIGN KEY constraints. Directs scripting when declarative referential integrity establishes dependency relationships. Applies only when scripting references a SQL Server table. |
SQLDMOScript_DRI_NonClustered | 4194304 | Generated script creates nonclustered indexes. Directs scripting when declarative referential integrity establishes dependency relationships. Applies only when scripting references a SQL Server table. |
SQLDMOScript_DRI_PrimaryKey | 268435456 | Generated script creates PRIMARY KEY constraints. Directs scripting when declarative referential integrity establishes dependency relationships. Applies only when scripting references a SQL Server table. |
SQLDMOScript_DRI_UniqueKeys | 67108864 | Generated script creates candidate keys defined using a unique index. Directs scripting when declarative referential integrity establishes dependency relationships. Applies only when scripting references a SQL Server table. |
SQLDMOScript_DRIWithNoCheck | 536870912 | When using SQLDMOScript_DRI_ Checks, or SQLDMOScript_DRI_ ForeignKeys, generated script includes the WITH NOCHECK clause optimizing constraint creation. Applies only when scripting references a SQL Server table. |
SQLDMOScript_Drops | 1 | Generate Transact-SQL to remove referenced component. Script tests for existence prior to attempt to remove component |
SQLDMOScript_IncludeIfNotExists | 4096 | Transact-SQL creating a component is prefixed by a check for existence. When script is executed, component is created only when a copy of the named component does not exist. |
SQLDMOScript_Indexes | 73736 | SQLDMOScript_ ClusteredIndexes, SQLDMOScript_ NonClusteredIndexes, and SQLDMOScript_ DRIIndexes combined by using a logical OR. |
SQLDMOScript_NoIdentity | 1073741824 | Generated Transact-SQL statements do not include definition of identity property, seed, and increment. Applies only when scripting references a SQL Server table. |
SQLDMOScript_NonClusteredIndexes | 8192 | Generate Transact-SQL defining nonclustered indexes. Applies only when scripting references a SQL Server table. |
SQLDMOScript_ObjectPermissions | 2 | Include Transact-SQL privilege defining statements when scripting database objects. |
SQLDMOScript_OwnerQualify | 262144 | Object names in Transact-SQL generated to remove an object are qualified by the owner of the referenced object. Transact-SQL generated to create the referenced object qualify the object name using the current object owner. |
SQLDMOScript_Permissions | 34 | SQLDMOScript_ ObjectPermissions and SQLDMOScript_ DatabasePermissions combined by using a logical OR. |
SQLDMOScript_PrimaryObject | 4 | Generate Transact-SQL creating the referenced component. |
SQLDMOScript_TimestampToBinary | 524288 | When scripting object creation for a table or user-defined data type, convert 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 combined by using a logical OR. |
SQLDMOScript_Triggers | 16 | Generate Transact-SQL defining triggers. Applies only when scripting references a SQL Server table. |
SQLDMOScript_UDDTsToBaseType | 1024 | Convert specification of user-defined data types to the appropriate SQL Server base data type. Applies only when scripting references a SQL Server table. |
SQLDMOScript_UseQuotedIdentifiers | -1 | Use quote 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. With the list built, configure component transfer using the ScriptType and Script2Type properties.
Long, enumerated.
Read/write
HRESULT GetScriptType(SQLDMO_SCRIPT_TYPE* pRetVal);
HRESULT SetScriptType(SQLDMO_SCRIPT_TYPE NewValue);
AddObject Method | Script2Type Property |
AddObjectByName Method |