Drop Table
Support Forum for database administrators and web based access to important newsgroups related to databasesHi, how can you differentiate between system and user databases..
Post Follow-up to this messageThere's no actual property you can use, but the system databases are: master, model, msdb and tempdb (DB_ID IN (1,2,3,4), and all the others (DB_ID >= 5) are user databases. -- Jacco Schalkwijk SQL Server MVP "Moh" <Moh@discussions.microsoft.com> wrote in message news:61F8DB42-9296-4235-AFFE- 2C75B718678C@microso ft.com... > Hi, > > how can you differentiate between system and user databases..
Post Follow-up to this messagethanks for replying.. in my scripts i use name in (master,.....) i was thinking if there was other way to do it "Moh" wrote: > Hi, > > how can you differentiate between system and user databases..
Post Follow-up to this messageIn SQL Server we have only 4 system databases (MASTER, MODEL, TEMPDB, MSDB) and a user can not create a system database. Since system databases are created during SQL Server installation itself the DBID will be 1 - 4) master 1 tempdb 2 model 3 msdb 4 So for getting the system database you could run a query select * from master..sysdatabases where dbid<=4 Thanks Hari SQL Server MVP ____________________ ________________ Moh Wrote: Sent via SreeSharp NewsReader http://www.SreeSharp.com
Post Follow-up to this message> the system databases are: master, model, msdb and tempdb (DB_ID IN > (1,2,3,4), and all the others (DB_ID >= 5) are user databases. If replication is enabled, the 'distribution' database that may be assigned dbid >= 5. This should also be categorized as a system database, IMHO. -- Hope this helps. Dan Guzman SQL Server MVP "Jacco Schalkwijk" <jacco.please.reply@to.newsgroups.mvps.org.invalid> wrote in message news:u9FNr$WNFHA.2736@TK2MSFTNGP09.phx.gbl... > There's no actual property you can use, but the system databases are: > master, model, msdb and tempdb (DB_ID IN (1,2,3,4), and all the others > (DB_ID >= 5) are user databases. > > -- > Jacco Schalkwijk > SQL Server MVP > > > "Moh" <Moh@discussions.microsoft.com> wrote in message > news:61F8DB42-9296-4235-AFFE- 2C75B718678C@microso ft.com... > >
Post Follow-up to this messageI would continue going by database name... -- Tibor Karaszi, SQL Server MVP http://www.karaszi.com/sqlserver/default.asp http://www. solidqualitylearning .com/ http://www.sqlug.se/ "Moh" <Moh@discussions.microsoft.com> wrote in message news:47E600AE-7AB9-438E-A785- F87FAEEBA68C@microso ft.com... > thanks for replying.. > > in my scripts i use name in (master,.....) i was thinking if there was oth er > way to do it > > "Moh" wrote: >
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread