Five Undocumented SQL Server 2014 OLEDB Stored Procedures
SQL Server 2014 supports the following useful undocumented oledb stored procedures:
- sp_oledb_database
- sp_oledb_defdb
- sp_oledb_deflang
- sp_oledb_language
- sp_oledb_ro_usrname
sp_oledb_database
The sp_oledb_database stored procedure returns the oledb database name.
Syntax
sp_oledb_database
Return Code Values
None.
Result Sets
Column name | Type | Description |
name | sysname | The name of the oledb database |
Remarks
This stored procedure exists in the master database, but can be invoked from any other databases.
Permissions
Requires membership in the public role.
Example
This is the example to get the name of the oledb database:
EXEC sp_oledb_database
sp_oledb_defdb
The sp_oledb_defdb database engine stored procedure returns the name of the default database
for the current user.
Syntax
sp_oledb_defdb
Return Code Values
None.
Result Sets
Column name | Type | Description |
dbname | sysname | The name of the default database for the current user |
Remarks
This stored procedure exists in the master database, but can be invoked from any other databases.
Permissions
Requires membership in the public role.
Example
This is the example to get the name of the default database for the current user:
EXEC sp_oledb_defdb
sp_oledb_deflang
The sp_oledb_deflang database engine stored procedure returns the name of the default language
for the current user.
Syntax
sp_oledb_deflang
Return Code Values
None.
Result Sets
Column name | Type | Description |
language | sysname | The name of the default language for the current user |
Remarks
This stored procedure exists in the master database, but can be invoked from any other databases.
Permissions
Requires membership in the public role.
Example
This is the example to get the name of the default language for the current user:
EXEC sp_oledb_deflang
sp_oledb_language
The sp_oledb_language database engine stored procedure returns the official language name and
alternative language name for each language presents in the instance of SQL Server 2014.
Syntax
sp_oledb_language
Return Code Values
None.
Result Sets
Column name | Type | Description |
alias | sysname | Alternative language name, for example, French |
name | sysname | Official language name, for example, Francais |
Remarks
This stored procedure exists in the master database, but can be invoked from any other databases.
Permissions
Requires membership in the public role.
Example
This is the example to get the list of all supported languages:
EXEC sp_oledb_language
sp_oledb_ro_usrname
The sp_oledb_ro_usrname stored procedure returns the oledb database read only status.
Syntax
sp_oledb_ro_usrname
Return Code Values
None.
Result Sets
Column name | Type | Description |
is_read_only | char(1) | “N” or “Y”, N – not read only, Y – read only |
user_name | sysname | The current database user |
Remarks
This stored procedure exists in the master database, but can be invoked from any other databases.
Permissions
Requires membership in the public role.
Example
This is the example to get the oledb database read only status:
EXEC sp_oledb_ro_usrname