共用方式為


CreationScriptOptions Property

未來的 Microsoft SQL Server 版本將移除這項功能。請避免在新的開發工作中使用這項功能,並規劃修改目前使用這項功能的應用程式。

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

語法

object.CreationScriptOptions [=value]

Parts

  • object
    An 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

Includes clustered index creation on tables in the script.

SQLDMOCreationScript_Collation

4096

Replicates column-level collation.

SQLDMOCreationScript_/CustomProcs

2

Generates custom stored procedures for the article if defined (transactional replication only).

SQLDMOCreationScript_/DisableScripting

0

Does not script.

SQLDMOCreationScript_/DRI_Checks

1024

Includes creation of check constraints during creation of tables in the script.

SQLDMOCreationScript_/DRI_Defaults

2048

Includes creation of column defaults during creation of tables in the script.

SQLDMOCreationScript_/DRI_ForeignKeys

512

Includes creation of foreign keys during creation of tables in the script.

SQLDMOCreationScript_/DRI_PrimaryKey

128

Includes definition of primary keys on tables in the script.

SQLDMOCreationScript_/DRI_UniqueKeys

16384

Includes creation of unique keys during creation of tables in the script.

SQLDMOCreationScript_/ExtendedProperties

8192

Replicates extended properties.

SQLDMOCreationScript_/NonClusteredIndexes

64

Includes nonclustered index creation on tables in the script.

SQLDMOCreationScript_/PKUKAsConstraints

32768

Include creation of primary keys and unique keys during creation of tables as constraints instead of as indexes in the script.

SQLDMOCreationScript_/PrimaryObject

1

Includes object creation in the script.

SQLDMOCreationScript_/UDDTsToBaseTypes

32

Converts all user-defined data types to their Microsoft SQL Server base types when columns are defined in table creation in the script.

SQLDMOCreationScript_/UserTriggers

256

Includes creation of triggers 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);

備註

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 an indexed view is published 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.

[!附註]

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.