SQL Server/T-SQL/System/DB ID

Материал из SQL эксперт
Перейти к: навигация, поиск

Returning the Current Database ID and Name

   <source lang="sql">

This DB_ID function returns the database integer ID and DB_NAME returns the database name for the current database. 5> 6> 7> SELECT DB_ID("master") DatabaseID, DB_NAME(1) DatabaseNM 8> GO DatabaseID DatabaseNM


-------------------------------------------------------------------------------------------------------------
        1 master

(1 rows affected)

</source>