KaranGupta
asked on
System databases Vs User created databases
Hi
I am using following query to get the list of db
select * from sys.databases (or select * from sysdatabases)
My question is how can we know that which db is system database and which one is user created?
Regards
Karan Gupta
I am using following query to get the list of db
select * from sys.databases (or select * from sysdatabases)
My question is how can we know that which db is system database and which one is user created?
Regards
Karan Gupta
ASKER
is 1-4 id fixed for system dbs in all versions of sql server. What is the role of sid field
SID is a system-level identification number.
when an object is created it is assigned an id - SID, that number identifies the object as a securable within SQL Server and then the object is deleted, the id is recycled.
when an object is created it is assigned an id - SID, that number identifies the object as a securable within SQL Server and then the object is deleted, the id is recycled.
you can also use
SELECT * FROM sys.databases
WHERE owner_sid != 1
ASKER
so what is good practice using sid to identify db or using id what BCUNNEY has suggested
either one will work
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I think it would be fair to split the points with BCUNNEY
Select *
From sys.databases
Where database_id > 5
--System Databases
Select *
From sys.databases
Where database_id <= 5