--- title: "sp_dropserver (Transact-SQL) | Microsoft Docs" ms.custom: "" ms.date: "03/14/2017" ms.prod: "sql-non-specified" ms.reviewer: "" ms.suite: "" ms.technology: - "database-engine" ms.tgt_pltfrm: "" ms.topic: "language-reference" f1_keywords: - "sp_dropserver_TSQL" - "sp_dropserver" dev_langs: - "TSQL" helpviewer_keywords: - "sp_dropserver" ms.assetid: 0fc83e35-0caa-49a3-a4b6-a1890d4f46ef caps.latest.revision: 29 author: "BYHAM" ms.author: "rickbyh" manager: "jhubbard" --- # sp_dropserver (Transact-SQL) [!INCLUDE[tsql-appliesto-ss2008-xxxx-xxxx-xxx_md](../../includes/tsql-appliesto-ss2008-xxxx-xxxx-xxx-md.md)] Removes a server from the list of known remote and linked servers on the local instance of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)]. || |-| |**Applies to**: [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] ([!INCLUDE[ssKatmai](../../includes/sskatmai-md.md)] through [current version](http://go.microsoft.com/fwlink/p/?LinkId=299658)).| ![Topic link icon](../../database-engine/configure-windows/media/topic-link.gif "Topic link icon") [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md) ## Syntax ``` sp_dropserver [ @server = ] 'server' [ , [ @droplogins = ] { 'droplogins' | NULL} ] ``` ## Arguments [ **@server =** ] **'***server***'** Is the server to be removed. *server* is **sysname**, with no default. *server* must exist. [ **@droplogins =** ] **'droplogins'** | NULL Indicates that related remote and linked server logins for *server* must also be removed if **droplogins** is specified. **@droplogins** is **char(10)**, with a default of NULL. ## Return Code Values 0 (success) or 1 (failure) ## Remarks If you run **sp_dropserver** on a server that has associated remote and linked server login entries, or is configured as a replication publisher, an error message is returned. To remove all remote and linked server logins for a server when you remove the server, use the **droplogins** argument. **sp_dropserver** cannot be executed inside a user-defined transaction. ## Permissions Requires ALTER ANY LINKED SERVER permission on the server. ## Examples The following example removes the remote server `ACCOUNTS` and all associated remote logins from the local instance of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)]. ``` sp_dropserver 'ACCOUNTS', 'droplogins'; ``` ## See Also [Security Stored Procedures (Transact-SQL)](../../relational-databases/system-stored-procedures/security-stored-procedures-transact-sql.md) [sp_addserver (Transact-SQL)](../../relational-databases/system-stored-procedures/sp-addserver-transact-sql.md) [sp_dropremotelogin (Transact-SQL)](../../relational-databases/system-stored-procedures/sp-dropremotelogin-transact-sql.md) [sp_helpremotelogin (Transact-SQL)](../../relational-databases/system-stored-procedures/sp-helpremotelogin-transact-sql.md) [sp_helpserver (Transact-SQL)](../../relational-databases/system-stored-procedures/sp-helpserver-transact-sql.md) [System Stored Procedures (Transact-SQL)](../../relational-databases/system-stored-procedures/system-stored-procedures-transact-sql.md)