---
title: "Delete a Pull Subscription | Microsoft Docs"
ms.custom: ""
ms.date: "03/06/2017"
ms.prod: "sql-server-2014"
ms.reviewer: ""
ms.technology: replication
ms.topic: conceptual
helpviewer_keywords:
- "removing subscriptions"
- "deleting subscriptions"
- "pull subscriptions [SQL Server replication], deleting"
- "subscriptions [SQL Server replication], pull"
ms.assetid: 997c0b8e-d8d9-4eed-85b1-6baa1f8594ce
author: MashaMSFT
ms.author: mathoma
manager: craigg
---
# Delete a Pull Subscription
This topic describes how to delete a pull subscription in [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)] by using [!INCLUDE[ssManStudioFull](../../includes/ssmanstudiofull-md.md)], [!INCLUDE[tsql](../../includes/tsql-md.md)], or Replication Management Objects (RMO).
**In This Topic**
- **To delete a pull subscription, using:**
[SQL Server Management Studio](#SSMSProcedure)
[Transact-SQL](#TsqlProcedure)
[Replication Management Objects (RMO)](#RMOProcedure)
## Using SQL Server Management Studio
Delete a pull subscription at the Publisher (from the **Local Publications** folder in [!INCLUDE[ssManStudioFull](../../includes/ssmanstudiofull-md.md)]) or the Subscriber (from the **Local Subscriptions** folder). Deleting a subscription does not remove objects or data from the subscription; they must be removed manually.
#### To delete a pull subscription at the Publisher
1. Connect to the Publisher in [!INCLUDE[ssManStudioFull](../../includes/ssmanstudiofull-md.md)], and then expand the server node.
2. Expand the **Replication** folder, and then expand the **Local Publications** folder.
3. Expand the publication associated with the subscription you want to delete.
4. Right-click the subscription, and then click **Delete**.
5. In the confirmation dialog box, select whether to connect to the Subscriber to delete subscription information. If you clear the **Connect to Subscriber** check box, you should connect to the Subscriber later to delete the information.
#### To delete a pull subscription at the Subscriber
1. Connect to the Subscriber in [!INCLUDE[ssManStudioFull](../../includes/ssmanstudiofull-md.md)], and then expand the server node.
2. Expand the **Replication** folder, and then expand the **Local Subscriptions** folder.
3. Right-click the subscription you want to delete, and then click **Delete**.
4. In the confirmation dialog box, select whether to connect to the Publisher to delete subscription information. If you clear the **Connect to Publisher** check box, you should connect to the Publisher later to delete the information.
## Using Transact-SQL
Pull subscriptions can be deleted programmatically using replication stored procedures. The stored procedures used will depend on the type of publication to which the subscription belongs.
#### To delete a pull subscription to a snapshot or transactional publication
1. At the Subscriber on the subscription database, execute [sp_droppullsubscription (Transact-SQL)](/sql/relational-databases/system-stored-procedures/sp-droppullsubscription-transact-sql). Specify **@publication**, **@publisher**, and **@publisher_db**.
2. At the Publisher on the publication database, execute [sp_dropsubscription (Transact-SQL)](/sql/relational-databases/system-stored-procedures/sp-dropsubscription-transact-sql). Specify **@publication** and **@subscriber**. Specify a value of **all** for **@article**. (Optional) If the Distributor cannot be accessed, specify a value of **1** for **@ignore_distributor** to delete the subscription without removing related objects at the Distributor.
#### To delete a pull subscription to a merge publication
1. At the Subscriber on the subscription database, execute [sp_dropmergepullsubscription (Transact-SQL)](/sql/relational-databases/system-stored-procedures/sp-dropmergepullsubscription-transact-sql). Specify **@publication**, **@publisher**, and **@publisher_db**.
2. At the Publisher on the publication database, execute [sp_dropmergesubscription (Transact-SQL)](/sql/relational-databases/system-stored-procedures/sp-dropmergesubscription-transact-sql). Specify **@publication**, **@subscriber**, and **@subscriber_db**. Specify a value of **pull** for **@subscription_type**. (Optional) If the Distributor cannot be accessed, specify a value of **1** for **@ignore_distributor** to delete the subscription without removing related objects at the Distributor.
### Examples (Transact-SQL)
The following example deletes a pull subscription to a transactional publication. The first batch is executed at the Subscriber and the second is executed at the Publisher.
[!code-sql[HowTo#sp_droptranpullsubscription](../../snippets/tsql/SQL15/replication/howto/tsql/droptranpullsub.sql#sp_droptranpullsubscription)]
[!code-sql[HowTo#sp_droptransubscription](../../snippets/tsql/SQL15/replication/howto/tsql/droptranpullsub.sql#sp_droptransubscription)]
The following example deletes a pull subscription to a merge publication. The first batch is executed at the Subscriber and the second is executed at the Publisher.
[!code-sql[HowTo#sp_dropmergepullsubscription](../../snippets/tsql/SQL15/replication/howto/tsql/dropmergepullsub.sql#sp_dropmergepullsubscription)]
[!code-sql[HowTo#sp_dropmergesubscription](../../snippets/tsql/SQL15/replication/howto/tsql/dropmergepullsub.sql#sp_dropmergesubscription)]
## Using Replication Management Objects (RMO)
You can delete pull subscriptions programmatically by using Replication Management Objects (RMO). The RMO classes that you use to delete a pull subscription depend on the type of publication to which the pull subscription is subscribed.
#### To delete a pull subscription to a snapshot or transactional publication
1. Create connections to both the Subscriber and Publisher by using the Class.
2. Create an instance of the class, and set the , , , and properties. Use the Subscriber connection from step 1 to set the property.
3. Check the property to verify that the subscription exists. If the value of this property is `false`, either the subscription properties in step 2 were defined incorrectly or the subscription does not exist.
4. Call the method.
5. Create an instance of the class by using the Publisher connection from step 1. Specify , and .
6. Call the method. If this method returns `false`, either the properties specified in step 5 are incorrect or the publication does not exist on the server.
7. Call the method. Specify the name of the Subscriber and the subscription database for the *subscriber* and *subscriberDB* parameters.
#### To delete a pull subscription to a merge publication
1. Create connections to both the Subscriber and Publisher by using the Class.
2. Create an instance of the class, and set the , , , and properties. Use the connection from step 1 to set the property.
3. Check the property to verify that the subscription exists. If the value of this property is `false`, either the subscription properties in step 2 were defined incorrectly or the subscription does not exist.
4. Call the method.
5. Create an instance of the class by using the Publisher connection from step 1. Specify , and .
6. Call the method. If this method returns `false`, either the properties specified in step 5 are incorrect or the publication does not exist on the server.
7. Call the method. Specify the name of the Subscriber and the subscription database for the *subscriber* and *subscriberDB* parameters.
### Examples (RMO)
This example deletes a pull subscription to a transactional publication and removes the subscription registration at the Publisher.
[!code-csharp[HowTo#rmo_DropTranPullSub](../../snippets/csharp/SQL15/replication/howto/cs/rmotestevelope.cs#rmo_droptranpullsub)]
[!code-vb[HowTo#rmo_vb_DropTranPullSub](../../snippets/visualbasic/SQL15/replication/howto/vb/rmotestenv.vb#rmo_vb_droptranpullsub)]
This example deletes a pull subscription to a merge publication and removes the subscription registration at the Publisher.
[!code-csharp[HowTo#rmo_DropMergePullSub](../../snippets/csharp/SQL15/replication/howto/cs/rmotestevelope.cs#rmo_dropmergepullsub)]
[!code-vb[HowTo#rmo_vb_DropMergePullSub](../../snippets/visualbasic/SQL15/replication/howto/vb/rmotestenv.vb#rmo_vb_dropmergepullsub)]
## See Also
[Subscribe to Publications](subscribe-to-publications.md)
[Replication Security Best Practices](security/replication-security-best-practices.md)