locked
database name RRS feed

  • Question

  • how can I find the database name of sql server?
    Tuesday, October 18, 2011 2:33 PM

Answers

  • Hi sklal120,

    You could open SSMS and click 'database' item under instance.

    Or you can get all the database name of the instance by running the below queries:

     ----SQL SERVER 2005 System Procedures
    EXEC
    sp_databases
    EXEC
    sp_helpdb
    ----SQL 2000 Method still works in SQL Server 2005
    SELECT
    name
    FROM
    sys.databases
    SELECT
    name
    FROM
    sys.sysdatabases
    ----SQL SERVER Un-Documented Procedure
    EXEC sp_msForEachDB 'PRINT ''?'''


    Best Regards,
    Peja

    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    • Marked as answer by Peja Tao Tuesday, October 25, 2011 7:46 AM
    Thursday, October 20, 2011 6:55 AM

All replies

  • select db_name()
    - Vishal

    SqlAndMe.com

    Tuesday, October 18, 2011 3:14 PM
  • Hi sklal120,

    You could open SSMS and click 'database' item under instance.

    Or you can get all the database name of the instance by running the below queries:

     ----SQL SERVER 2005 System Procedures
    EXEC
    sp_databases
    EXEC
    sp_helpdb
    ----SQL 2000 Method still works in SQL Server 2005
    SELECT
    name
    FROM
    sys.databases
    SELECT
    name
    FROM
    sys.sysdatabases
    ----SQL SERVER Un-Documented Procedure
    EXEC sp_msForEachDB 'PRINT ''?'''


    Best Regards,
    Peja

    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    • Marked as answer by Peja Tao Tuesday, October 25, 2011 7:46 AM
    Thursday, October 20, 2011 6:55 AM