Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

system and user databases.
Hi,

how can you differentiate between system and user databases..

Report this thread to moderator Post Follow-up to this message
Old Post
Moh
03-31-05 12:03 AM


Re: system and user databases.
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..



Report this thread to moderator Post Follow-up to this message
Old Post
Jacco Schalkwijk
03-31-05 12:03 AM


RE: 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..

Report this thread to moderator Post Follow-up to this message
Old Post
Moh
03-31-05 12:03 AM


Re:system and user databases.
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

Report this thread to moderator Post Follow-up to this message
Old Post
Hari Prasad
03-31-05 12:03 AM


Re: system and user databases.
> 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... 
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Dan Guzman
03-31-05 12:34 AM


Re: system and user databases.
I 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:
> 



Report this thread to moderator Post Follow-up to this message
Old Post
Tibor Karaszi
03-31-05 12:01 PM


Sponsored Links





Last Thread Next Thread
Post New Thread

MS SQL Server archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 01:13 PM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006