Mega Code Archive

 
Categories / MSSQL Tutorial / System Settings
 

Returning the Current Database ID and Name

4>  SELECT DB_ID() DatabaseID, DB_NAME() DatabaseNM 5> GO DatabaseID DatabaseNM ---------- ------------------------------------------------------------------------------------------------------------- -------------------          1 master (1 rows affected)