Get the Name or ID of the current Database in SQL Server
SELECT DB_NAME() AS Database_Name
To get the current Database ID used while running the query:
SELECT DB_ID() AS Database_ID
To see how to get Database Name from Database ID and Database ID from Database Name in SQL Server read related article:
Get Database Name from Database ID and Database ID from Database Name in SQL Server
No comments:
Post a Comment