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 publications
- AgentLogin
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 SQLServer object 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. |