How to Know if a database is a system database or a user database

  • Hi,

    How to Know if a database is a system database or a user database.

    Thanks

  • database_id <= 4 is system db.

    databse_id > 4 is user db

    or... if name is

    Master

    Msdb

    Tempdb

    Model

    Then its system db

  • The approach Management Studio is using is simply checking the name of the database like

    db.name in ('master','model','msdb','tempdb')

    Regards,

    Andras


    Andras Belokosztolszki, MCPD, PhD
    GoldenGate Software

  • There are some more system databases are there as mentioned below

    Reportserver - Will be created @ the time of configuring reporting services

    Reportservertempdb - Will be created @ the time of configuring reporting services

    distribution - Will be created @ the time of replication for storing the changes in the articles

  • In Sql 2005 system databases are under System Databases folder (i.e master,model, msdb,tempdb) User Databases are found below System Databases folder.

    Regards

    Buyi

  • Thanks to all,

    Like vidhya sagar said There are some more system databases Reportserver and distribution (which also can be renamed).

    so using db.name in ('master','model','msdb','tempdb') is not the efficient way, but the only one I found so far

    Ahmed

  • technically ReportServer and ReportServerTempDB are user databases.

    sorry, forgot distribution which is also system db

Viewing 7 posts - 1 through 6 (of 6 total)

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