get list of databases

  • how to get list of all the databases in sql server through sql query?....

  • There are plenty of discussions here on how to do that.  I would try using the search option on the toolbar and type in list databases.

     



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

  • Here's a short query :

    Select dbid, name from master.dbo.SysDatabases

  • To avoid using system tables use the INFORMATION_SCHEMA objects:

    SELECT CATALOG_NAME

    FROM INFORMATION_SCHEMA.SCHEMATA

    If you need dbid:

    SELECT DB_ID(CATALOG_NAME), CATALOG_NAME

    FROM INFORMATION_SCHEMA.SCHEMATA

  • I would recommend that in future you try a different forum because your question has nothing to do with either SQL Server Yukon or Business Intelligence.

     

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply