| title | ORIGINAL_DB_NAME (Transact-SQL) | ||
|---|---|---|---|
| description | ORIGINAL_DB_NAME (Transact-SQL) | ||
| author | VanMSFT | ||
| ms.author | vanto | ||
| ms.date | 03/06/2017 | ||
| ms.service | sql | ||
| ms.subservice | t-sql | ||
| ms.topic | reference | ||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| dev_langs |
|
[!INCLUDE SQL Server Azure SQL Managed Instance]
Returns the database name specified by the user in the database connection string. This database is specified by using the sqlcmd-d option (USE database). It can also be specified with the Open Database Connectivity (ODBC) data source expression (initial catalog =databasename).
This database is different from the default user database.
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
ORIGINAL_DB_NAME ()
If the initial database isn't specified, the function returns an empty string.