SQL Server query to find all current database names

前端 未结 8 615
傲寒
傲寒 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.

提交回复
热议问题