Remotely adds a subscription to a particular article within a publication.
sp_subscribe publication, [article [, destination_db
[, @sync_type = {'automatic' | 'manual' | 'none'}]]]
where
If set to none, there is no synchronization. A synchronization file is not created, there is no synchronization job passed to the distribution database, and the subscriber's status is set to active instead of subscribed. All future transactions are sent to the subscriber.
This stored procedure causes rows to be added to the syssubscriptions table only if those rows indicate that the publication was unrestricted. If the publication was restricted, a valid entry must already exist in syssubscriptions. Running sp_subscribe causes the status for this entry to be changed from inactive to subscribed.
This example adds remote subscription to the types_table article in the pub_alltype publication for the mydb database (on the subscription server) and sets the synchronization type to manual.
sp_subscribe pub_alltypes, types_table, mydb, 'manual'
Execute permission defaults to the system administrator and database owner and is also granted to repl_subscriber.
sysarticles, syspublications, syssubscriptions, sysservers
sp_addsubscription | sp_dropsubscription |
sp_changesubscription | sp_helpsubscription |
sp_changesubstatus | sp_unsubscribe |