Logo 
Search:

SQL Server Articles

Submit Article
Home » Articles » SQL Server » Meta Data FunctionsRSS Feeds

DB_NAME Function

Posted By: Sarita Patel     Category: SQL Server     Views: 1862

This article explains about DB_NAME function in sql server with examples.

DB_NAME function is used to get database name.


Syntax of DB_NAME Function :

DB_NAME ( [ database_id ] )

database_id is an identification number of database. It is an optional parameter. It is of type smallint.

Return type of DB_ID function is nvarchar(128).



Examples of DB_NAME Function :

Example 1 : Use of DB_NAME function to get database name in select clause

SELECT DB_NAME (10)

Output
Northwind

Above example returns name of provided database id.
  
Share: 

 
 
 

Didn't find what you were looking for? Find more on DB_NAME Function Or get search suggestion and latest updates.

Sarita Patel
Sarita Patel author of DB_NAME Function is from United States.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!