Skip to content

Latest commit

 

History

History
78 lines (55 loc) · 2.73 KB

sp-dropserver-transact-sql.md

File metadata and controls

78 lines (55 loc) · 2.73 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs monikerRange
sp_dropserver (Transact-SQL)
Removes a server from the list of known remote and linked servers on the local instance of SQL Server.
markingmyname
maghan
randolphwest
11/28/2023
sql
system-objects
reference
sp_dropserver_TSQL
sp_dropserver
sp_dropserver
TSQL
=azuresqldb-mi-current || >=sql-server-2016 || >=sql-server-linux-2017

sp_dropserver (Transact-SQL)

[!INCLUDE SQL Server - ASDBMI]

Removes a server from the list of known remote and linked servers on the local instance of [!INCLUDE ssNoVersion].

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

sp_dropserver
    [ @server = ] N'server'
    [ , [ @droplogins = ] 'droplogins' ]
[ ; ]

Arguments

[ @server = ] N'server'

The server to be removed. @server is sysname, with no default. @server must exist.

[ @droplogins = ] 'droplogins'

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

An error is returned if you run sp_dropserver on a server with associated remote and linked server login entries, or is configured as a replication publisher. To remove all remote and linked server logins for a server when you remove the server, use the @droplogins argument.

sp_dropserver can't be executed inside a user-defined transaction.

Using sp_dropserver to change the local server name can cause unintended effects or unsupported configurations.

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].

EXEC sp_dropserver 'ACCOUNTS', 'droplogins';

Related content