Skip to content

Latest commit

 

History

History
64 lines (46 loc) · 2.35 KB

sp-enumdsn-transact-sql.md

File metadata and controls

64 lines (46 loc) · 2.35 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
sp_enumdsn (Transact-SQL)
Returns a list of all defined ODBC and OLE DB data source names for a server running under a specific Windows user account.
markingmyname
maghan
randolphwest
07/16/2024
sql
replication
reference
sp_enumdsn
sp_enumdsn_TSQL
sp_enumdsn
TSQL

sp_enumdsn (Transact-SQL)

[!INCLUDE SQL Server]

Returns a list of all defined ODBC and OLE DB data source names for a server running under a specific Windows user account. This stored procedure is executed at the Publisher on any database.

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

Syntax

sp_enumdsn
[ ; ]

Arguments

None.

Return code values

0 (success) or 1 (failure).

Result set

Column name Data type Description
Data Source Name sysname Name of the data source.
Description varchar(255) Description of the data source.
Type int Type of data source:

1 = ODBC DSN
3 = OLE DB data source
Provider Name varchar(255) Name of the OLE DB provider. Value is NULL for ODBC DSN.

Remarks

Every [!INCLUDE ssNoVersion] service has a user context. A user context is a set of Registry entries that includes the definitions of the ODBC data sources for the user. The user context is provided by the username under which the [!INCLUDE ssNoVersion] is running.

For example, if the server is running under the system account user context, the data source names (DSNs) that are returned are all system DSNs that are associated with the system account. If the server is running under a private user account, only the DSNs defined for that private account of that user is returned.

Permissions

Only members of the sysadmin fixed server role can execute sp_enumdsn.

Related content