Events
Mar 31, 11 PM - Apr 2, 11 PM
The biggest SQL, Fabric and Power BI learning event. March 31 – April 2. Use code FABINSIDER to save $400.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Applies to:
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.
Transact-SQL syntax conventions
sp_enumdsn
[ ; ]
None.
0
(success) or 1
(failure).
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 DSN3 = OLE DB data source |
Provider Name |
varchar(255) | Name of the OLE DB provider. Value is NULL for ODBC DSN. |
Every SQL Server 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 SQL Server 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.
Only members of the sysadmin fixed server role can execute sp_enumdsn
.
Events
Mar 31, 11 PM - Apr 2, 11 PM
The biggest SQL, Fabric and Power BI learning event. March 31 – April 2. Use code FABINSIDER to save $400.
Register today