Click here to Skip to main content
14,301,895 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hello everyone,

I have Sql Server 2008 enterprise version installed on my machine. There are numbers of database listed including system generated database.

Now here is the issue ( I want to get user created database list only not system generated database.)

Please provide me query to get user created database list.

Thanks in advance
Posted

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

In SQL 2005, you can try the following:
SELECT * FROM sys.databases where owner_sid != 1

SQL 2000
select * from sysdatabases

Please check the following link for other options:
http://databases.aspfaq.com/schema-tutorials/schema-how-do-i-list-the-databases-on-my-server.html[^]
   
Comments
awadhendra tiwari 18-Apr-11 10:04am
   
This solution does give me correct answer. I need only user defined databases not system databases such as Master,Model or tempsDB.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100