Friday, 1 April 2016

How to find the database Name in SQL Server ?

In a Single SQL Server Instance ,it is possible to have multiple databases.
Each database has its own unique ID.

If you know the database ID then
refer the following syntax 

Syntax:

DB_NAME('Database ID')

Example:

SELECT DB_NAME(5)

Output:

Sample


For the ID : 5 the Name of the database is Sample.

No comments:

Post a Comment