|
Home > Archive > MS SQL Server > March 2005 > system and user databases.
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
system and user databases.
|
|
|
| Hi,
how can you differentiate between system and user databases..
| |
| Jacco Schalkwijk 2005-03-30, 7:03 pm |
| 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...
> Hi,
>
> how can you differentiate between system and user databases..
| |
|
| thanks 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..
| |
| Hari Prasad 2005-03-30, 7:03 pm |
|
In 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
| |
| Dan Guzman 2005-03-30, 7:34 pm |
| > 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...
>
>
| |
|
|
|
|
|