ORIGINAL_DB_NAME (Transact-SQL)

ORIGINAL_DB_NAME (Transact-SQL)

 

THIS TOPIC APPLIES TO:yesSQL Server (starting with 2008)noAzure SQL DatabasenoAzure SQL Data Warehouse noParallel Data Warehouse

Returns the database name that is specified by the user in the database connection string. This is the database that is specified by using the sqlcmd-d option (USE database) or the ODBC data source expression (initial catalog =databasename).

This database is not the same as the default user database.

Topic link icon Transact-SQL Syntax Conventions

  
ORIGINAL_DB_NAME ()  

If the initial database is not specified, the function returns an empty string.

sqlcmd Utility
osql Utility
SQL Server Native Client (ODBC)

Community Additions

ADD
Show:
© 2016 Microsoft