CreationScriptOptions Property

SQL-DMO

SQL-DMO

CreationScriptOptions Property

The CreationScriptOptions property specifies creation attributes for database objects implementing a replication article.

Applies To
MergeArticle Object TransArticle Object
Syntax

object.CreationScriptOptions [= value]

object

Expression that evaluates to an object in the Applies To list

value

Specifies article-implementing object creation as described in Settings

Settings
Constant Value Description
SQLDMOCreationScript_ClusteredIndexes 16 Include clustered index creation on tables in the script
SQLDMOCreationScript_Collation 4096 Replicate column-level collation
SQLDMOCreationScript_CustomProcs 2 Generates custom stored procedures for the article if defined (transactional replication only)
SQLDMOCreationScript_DisableScripting 0 Do not script
SQLDMOCreationScript_DRI_Checks 1024 Include creation of check constraints during creation of tables in the script
SQLDMOCreationScript_DRI_Defaults 2048 Include creation of column defaults during creation of tables in the script
SQLDMOCreationScript_DRI_ForeignKeys 512 Include creation of foreign keys during creation of tables in the script
SQLDMOCreationScript_DRI_PrimaryKey 128 Include definition of primary keys on tables in the script
SQLDMOCreationScript_DRI_UniqueKeys 16384 Include creation of unique key during creation of tables in the script
SQLDMOCreationScript_ExtendedProperties 8192 Replicate extended properties
SQLDMOCreationScript_NonClusteredIndexes 64 Include nonclustered index creation on tables in the script
SQLDMOCreationScript_PKUKAsConstraints 32768 Include creation of primary key and unique key during creation of tables as constraints instead of as indexes in the script
SQLDMOCreationScript_PrimaryObject 1 Include object creation in the script
SQLDMOCreationScript_UDDTsToBaseTypes 32 Convert all user-defined data types to their Microsoft® SQL  Server™ base types when defining columns in table creation in the script
SQLDMOCreationScript_UserTriggers 256 Include creation of trigger during creation of tables in the script

Data Type

Long, enumerated

Modifiable

Read/write

Prototype (C/C++)

HRESULT GetCreationScriptOptions(
SQLDMO_CREATIONSCRIPT_TYPE* pRetVal);

HRESULT SetCreationScriptOptions(
SQLDMO_CREATIONSCRIPT_TYPE NewValue);

Remarks

The enumerated value is bit-packed. To specify multiple script creation options, combine individual enumeration values using the OR logical operator to define the behavior required.

When publishing an indexed view as an indexed view at a subscriber, only SQLDMOCreationScript_ExtendedProperties, SQLDMOCreationScript_NonClusteredIndexes, and SQLDMOCreationScript_UserTriggers are allowed. SQLDMOCreationScript_ClusteredIndexes and SQLDMOCreationScript_PrimaryObject must also be used.

Note  If an application sets CreationScriptOptions after the initial snapshot has been created, a new snapshot must be generated and reapplied to each subscription. Snapshots are applied when the next scheduled snapshot and distribution or merge agent run.