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.