--To get the
current database name
SELECT DB_NAME() AS [Database NAME];
--To get current
database id
SELECT DB_ID() AS [Database ID];
Database NAME
------------------
Northwind
(1 row(s) affected)
Database ID
-----------
26
(1 row(s) affected)
Thanks for reading :)