Skip to content

Latest commit

 

History

History
53 lines (43 loc) · 1.71 KB

File metadata and controls

53 lines (43 loc) · 1.71 KB
title ORIGINAL_DB_NAME (Transact-SQL) | Microsoft Docs
ms.custom
ms.date 03/06/2017
ms.prod sql
ms.prod_service sql-database
ms.service
ms.component t-sql|functions
ms.reviewer
ms.suite sql
ms.technology
database-engine
ms.tgt_pltfrm
ms.topic language-reference
f1_keywords
ORIGINAL_DB_NAME
ORIGINAL_DB_NAME_TSQL
dev_langs
TSQL
helpviewer_keywords
ORIGINAL_DB_NAME function
ms.assetid 7dadc40a-1287-4f31-8487-434ee477144d
caps.latest.revision 11
author edmacauley
ms.author edmaca
manager craigg
ms.workload Inactive

ORIGINAL_DB_NAME (Transact-SQL)

[!INCLUDEtsql-appliesto-ss2008-xxxx-xxxx-xxx-md]

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

Syntax

  
ORIGINAL_DB_NAME ()  

Remarks

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

See Also

sqlcmd Utility
osql Utility
SQL Server Native Client (ODBC)