| description | ORIGINAL_DB_NAME (Transact-SQL) | ||
|---|---|---|---|
| title | ORIGINAL_DB_NAME (Transact-SQL) | Microsoft Docs | ||
| ms.custom | |||
| ms.date | 03/06/2017 | ||
| ms.prod | sql | ||
| ms.prod_service | sql-database | ||
| ms.reviewer | |||
| ms.technology | t-sql | ||
| ms.topic | reference | ||
| f1_keywords |
|
||
| dev_langs |
|
||
| helpviewer_keywords |
|
||
| ms.assetid | 7dadc40a-1287-4f31-8487-434ee477144d | ||
| author | VanMSFT | ||
| ms.author | vanto |
[!INCLUDE SQL Server]
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.
Transact-SQL Syntax Conventions
ORIGINAL_DB_NAME ()
[!INCLUDEsql-server-tsql-previous-offline-documentation]
If the initial database isn't specified, the function returns an empty string.