How can i get the user database from the particular server

  • Hi All,

    SELECT

    *

    FROM

    sys.sysdatabases

    If i run the query it will display all the database's like System as well as user database for the particular server.In this, is it possible to extract only User database's for the particular server.

    Thanks in Advance. 🙂

  • SELECT

    *

    FROM

    sys.sysdatabases where version is null

  • Hi vyas,

    Thanks a lot for your quick reply.

    In my server if i create a new database that has version say 611

    along with this, system database (master,tempdb,model,msdb) has the same version.

    so it is not extracting the same.

    🙂

  • Select * from sys.databases where database_id > 4

    The syztem dbs have IDs from 1 to 4, the user databases from 5 up. (The system resource db is an exception, but it's not visible in sys.databases)

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thanks GilaMonster for your reply 😀

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

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