sp_helppublication (Transact-SQL)

 

Applies To: SQL Server

Returns information about a publication. For a Microsoft SQL Server publication, this stored procedure is executed at the Publisher on the publication database. For an Oracle publication, this stored procedure is executed at the Distributor on any database.

Topic link icon Transact-SQL Syntax Conventions

  
sp_helppublication [ [ @publication = ] 'publication' ]  
    [ , [ @found=] found OUTPUT]  
    [ , [ @publisher = ] 'publisher' ]  

[ @publication = ] 'publication'
Is the name of the publication to be viewed. publication is sysname, with a default of %, which returns information about all publications.

[ @found = ] 'found' OUTPUT
Is a flag to indicate returning rows. foundis int and an OUTPUT parameter, with a default of 23456. 1 indicates the publication is found. 0 indicates the publication is not found.

[ @publisher = ] 'publisher'
Specifies a non-SQL Server publisher. publisher is sysname, with a default of NULL.

System_CAPS_ICON_note.jpg Note


publisher should not be specified when requesting publication information from a SQL Server Publisher.

Column nameData typeDescription
pubidintID for the publication.
namesysnameName of the publication.
restrictedintIdentified for informational purposes only. Not supported. Future compatibility is not guaranteed.
statustinyintThe current status of the publication.

 0 = Inactive.

 1 = Active.
taskUsed for backward compatibility.
replication frequencytinyintType of replication frequency:

 0 = Transactional

 1 = Snapshot
synchronization methodtinyintSynchronization mode:

 0 = Native bulk copy program (bcp utility)

 1 = Character bulk copy

 3 = Concurrent, which means that native bulk copy (bcputility) is used but tables are not locked during the snapshot

 4 = Concurrent_c, which means that character bulk copy is used but tables are not locked during the snapshot
descriptionnvarchar(255)Optional description for the publication.
immediate_syncbitWhether the synchronization files are created or re-created each time the Snapshot Agent runs.
enabled_for_internetbitWhether the synchronization files for the publication are exposed to the Internet, through file transfer protocol (FTP) and other services.
allow_pushbitWhether push subscriptions are allowed on the publication.
allow_pullbitWhether pull subscriptions are allowed on the publication.
allow_anonymousbitWhether anonymous subscriptions are allowed on the publication.
independent_agentbitWhether there is a stand-alone Distribution Agent for this publication.
immediate_sync_readybitWhether or not the Snapshot Agent generated a snapshot that is ready to be used by new subscriptions. This parameter is defined only if the publication is set to always have a snapshot available for new or reinitialized subscriptions.
allow_sync_tranbitWhether immediate-updating subscriptions are allowed on the publication.
autogen_sync_procsbitWhether to automatically generate stored procedures to support immediate-updating subscriptions.
snapshot_jobidbinary(16)Scheduled task ID.
retentionintAmount of change, in hours, to save for the given publication.
has subscriptionbitIf the publication has an active subscriptions. 1 means that the publication has active subscriptions, and 0 means that the publication has no subscriptions.
allow_queued_tranbitSpecifies whether disables queuing of changes at the Subscriber until they can be applied at the Publisher has been enabled. If 0, changes at the Subscriber are not queued.
snapshot_in_defaultfolderbitSpecifies whether snapshot files are stored in the default folder. If 0, snapshot files have been stored in the alternate location specified by alternate_snapshot_folder. If 1, snapshot files can be found in the default folder.
alt_snapshot_foldernvarchar(255)Specifies the location of the alternate folder for the snapshot.
pre_snapshot_scriptnvarchar(255)Specifies a pointer to an .sql file location. The Distribution Agent will run the pre-snapshot script before running any of the replicated object scripts when applying a snapshot at a Subscriber.
post_snapshot_scriptnvarchar(255)Specifies a pointer to an .sql file location. The Distribution Agent will run the post-snapshot script after all the other replicated object scripts and data have been applied during an initial synchronization.
compress_snapshotbitSpecifies that the snapshot that is written to the alt_snapshot_folder location is to be compressed into the Microsoft CAB format. 0 specifies that the snapshot will not be compressed.
ftp_addresssysnameThe network address of the FTP service for the Distributor. Specifies where publication snapshot files are located for the Distribution Agent or Merge Agent of a subscriber to pick up.
ftp_portintThe port number of the FTP service for the Distributor.
ftp_subdirectorynvarchar(255)Specifies where the snapshot files will be available for the Distribution Agent or Merge Agent of subscriber to pick up if the publication supports propagating snapshots using FTP.
ftp_loginsysnameThe username used to connect to the FTP service.
allow_dtsbitSpecifies that the publication allows data transformations. 0 specifies that DTS transformations are not allowed.
allow_subscription_copybitSpecifies whether the ability to copy the subscription databases that subscribe to this publication has been enabled. 0 means that copying is not allowed.
centralized_conflictsbitSpecifies whether conflict records are stored on the Publisher:

 0 = Conflict records are stored at both the publisher and at the subscriber that caused the conflict.

 1 = Conflict records are stored at the Publisher.
conflict_retentionintSpecifies the conflict retention period, in days.
conflict_policyintSpecifies the conflict resolution policy followed when the queued updating subscriber option is used. Can be one of these values:

 1 = Publisher wins the conflict.

 2 = Subscriber wins the conflict.

 3 = Subscription is reinitialized.
queue_typeSpecifies which type of queue is used. Can be one of these values:

 msmq = Use Microsoft Message Queuing to store transactions.

 sql = Use SQL Server to store transactions.

Note: Support for Message Queuing has been discontinued.
backward_comp_levelDatabase compatibility level, and can be one of the following:

 90 = Microsoft SQL Server 2005

 100 = Microsoft SQL Server 2008
publish_to_ADbitSpecifies whether the publication is published in the Microsoft Active Directory™. A value of 1 indicates that it is published, and a value of 0 indicates that it is not published.
allow_initialize_from_backupbitIndicates if Subscribers can initialize a subscription to this publication from a backup rather than an initial snapshot. 1 means that subscriptions can be initialized from a backup, and 0 means that they cannot. For more information, see Initialize a Transactional Subscription Without a Snapshot a transactional Subscriber without a snapshot.
replicate_ddlintIndicates if schema replication is supported for the publication. 1 indicates that data definition language (DDL) statements executed at the publisher are replicated, and 0 indicates that DDL statements are not replicated. For more information, see Make Schema Changes on Publication Databases.
enabled_for_p2pintIf the publication can be used in a peer-to-peer replication topology. 1 indicates that the publication supports peer-to-peer replication. For more information, see Peer-to-Peer Transactional Replication.
publish_local_changes_onlyintIdentified for informational purposes only. Not supported. Future compatibility is not guaranteed.
enabled_for_het_subintSpecifies whether the publication supports non-SQL Server Subscribers. A value of 1 means that non-SQL Server Subscribers are supported. A value of 0 means that only SQL Server Subscribers are supported. For more information, see Non-SQL Server Subscribers.
enabled_for_p2p_conflictdetectionintSpecifies whether the Distribution Agent detects conflicts for a publication that is enabled for peer-to-peer replication. A value of 1 means that conflicts are detected. For more information, see Conflict Detection in Peer-to-Peer Replication.
originator_idintSpecifies an ID for a node in a peer-to-peer topology. This ID is used for conflict detection if enabled_for_p2p_conflictdetection is set to 1. For a list of IDs that have already been used, query the Mspeer_originatorid_history system table.
p2p_continue_onconflictintSpecifies whether The Distribution Agent continues to process changes when a conflict is detected. A value of 1 means that the agent continues to process changes.

 ** Caution ** We recommend that you use the default value of 0. When this option is set to 1, the Distribution Agent tries to converge data in the topology by applying the conflicting row from the node that has the highest originator ID. This method does not guarantee convergence. You should make sure that the topology is consistent after a conflict is detected. For more information, see "Handling Conflicts" in Conflict Detection in Peer-to-Peer Replication.
alllow_partition_switchintSpecifies whether ALTER TABLE…SWITCH statements can be executed against the published database. For more information, see Replicate Partitioned Tables and Indexes.
replicate_partition_switchintSpecifies whether ALTER TABLE…SWITCH statements that are executed against the published database should be replicated to Subscribers. This option is valid only if allow_partition_switch is set to 1.

0 (success) or 1 (failure)

sp_helppublication is used in snapshot and transactional replication.

sp_helppublication will return information on all publications that are owned by the user executing this procedure.

DECLARE @myTranPub AS sysname
SET @myTranPub = N'AdvWorksProductTran' 

USE [AdventureWorks2012]
EXEC sp_helppublication @publication = @myTranPub
GO

Only members of the sysadmin fixed server role at the Publisher or members of the db_owner fixed database role on the publication database or users in the publication access list (PAL) can execute sp_helppublication.

For a non-SQL Server Publisher, only members of the sysadmin fixed server role at the Distributor or members of the db_owner fixed database role on the distribution database or users in the PAL can execute sp_helppublication.

View and Modify Publication Properties
sp_addpublication (Transact-SQL)
sp_changepublication (Transact-SQL)
sp_droppublication (Transact-SQL)
Replication Stored Procedures (Transact-SQL)

Community Additions

ADD
Show: