EnumPublications2 Method
未來的 Microsoft SQL Server 版本將移除這項功能。請避免在新的開發工作中使用這項功能,並規劃修改目前使用這項功能的應用程式。
The EnumPublications2 method returns a QueryResults object that enumerates the publications of a replication publishing data source.
語法
object.EnumPublications2(ReplicationType ,DatabaseName ,PublicationName,AgentLogin ,bSecurityCheck)as QueryResults
Parts
object
Expression that evaluates to an object in the Applies To list.ReplicationType
Long integer that specifies a replication method and restricts result set membership as specified in Settings.DatabaseName
String that identifies a replication database by name. Use % to specify all databases.PublicationName
String that identifies a publication by name. Use NULL or an empty string to specify all publicationsAgentLogin
String that identifies a Microsoft SQL Server login or an empty string.bSecurityCheck
TRUE or FALSE as described in Settings.
Prototype (C/C++)
HRESULT EnumPublications2(LPSQLDMOQUERYRESULTS *ppResults,
SQLDMO_REPLICATION_TYPE ReplicationType
CPPDEFAULT(= SQLDMORepType_TransactionalMerge),
SQLDMO_LPCSTR DatabaseName CPPDEFAULT(= NULL),
SQLDMO_LPCSTR PublicationName CPPDEFAULT(= NULL),
SQLDMO_LPCSTR AgentLogin CPPDEFAULT(= NULL),
BOOL bSecurityCheck CPPDEFAULT(= FALSE));
Settings
Set ReplicationType using these values.
Constant |
Value |
Description |
---|---|---|
SQLDMORepType_Merge |
2 |
Result set enumerates merge replication publications. |
SQLDMORepType_/Transactional |
1 |
Result set enumerates transactional and snapshot replication publications. |
SQLDMORepType_/TransactionalMerge |
3 |
Result set enumerates all publications regardless of replication method. |
When bSecurityCheck is TRUE, the method enumerates only publications accessible to the login used for SQLServerobject connection. The AgentLogin argument is evaluated.
When bSecurityCheck is FALSE (default), all publications are enumerated.
Returns
A QueryResults object that contains one result set defined by these columns.
Column |
Data type |
Description |
---|---|---|
agent_access |
bit |
When TRUE, the login specified in the AgentLogin argument is a member of the publication access list. |
allow_anonymous |
bit |
When TRUE, anonymous subscriptions are allowed. |
allow_pull |
bit |
When TRUE, Subscriber-originated (pull) subscriptions are allowed. |
allow_sync_tran |
bit |
When TRUE, the transactional replication publication is updateable at the Subscriber. |
description |
nvarchar(256) |
Descriptive text. |
distribution_db |
nvarchar(129) |
Name of the distribution database. |
enabled_for_internet |
bit |
When TRUE, publication allows snapshot download using FTP. |
immediate_sync |
bit |
When TRUE, an updated snapshot is always be generated when the snapshot agent runs for the publication. This allows new subscribers to be added at any time and immediately synchronize with their publisher to receive a snapshot rather than having to wait for the latest snapshot to be delivered. |
immediate_sync_ready |
bit |
When TRUE, a snapshot exists for the publication. |
independent_agent |
bit |
TRUE for merge replication publications. |
publication |
nvarchar(129) |
Publication name. |
publisher |
nvarchar(129) |
Name of the data source publishing the data. |
publisher_db |
nvarchar(129) |
Database name. |
repl_freq |
tinyint |
Frequency used to replicate data. Interpret value using SQLDMO_REPFREQ_TYPE. |
replication_type |
tinyint |
Replication method. Interpret value using SQLDMO_REPLICATION_TYPE. |
thirdparty_flag |
bit |
When TRUE, the publication source is not an instance of SQL Server. |
vendor_name |
nvarchar(129) |
Name of the vendor of the product publishing the data. |
備註
The EnumPublications2 method differs from the EnumPublications method in that it includes a PublicationName parameter.
[!附註]
If an application calls EnumPublications2 on an instance of SQL Server version 7.0, the constant, SQLDMO_E_SQL80ONLY, and the message "This property or method requires Microsoft SQL Server 2000 or later" are returned.