SQL Server query to find all current database names

前端 未结 8 508
傲寒
傲寒 2020-12-03 09:34

I need a SQL query to find the names of existing databases.

相关标签:
8条回答
  • 2020-12-03 10:16

    You can also use these ways:

    EXEC sp_helpdb
    

    and:

    SELECT name FROM sys.sysdatabases
    

    Recommended Read:

    Don't forget to have a look at sysdatabases VS sys.sysdatabases

    A similar thread.

    0 讨论(0)
  • 2020-12-03 10:17

    This forum suggests also:

    SELECT CATALOG_NAME AS DataBaseName
    FROM INFORMATION_SCHEMA.SCHEMATA
    
    0 讨论(0)
提交回复
热议问题