Groups | Blog | Home
all groups > sql server (alternate) > march 2004 >

sql server (alternate) : Filter out system database(s)


rsmith NO[at]SPAM hvltd.com
3/12/2004 9:12:50 AM
This should probably be really easy but I cannot find the right
combination of SQL statements (pref. SQL-92 compliant) to return me a
list of databases from a SQL Server installation with a column that
signifies whether the database is a system database or not.

David Portas
3/12/2004 5:45:32 PM
SELECT catalog_name
FROM information_schema.schemata
WHERE catalog_name NOT IN ('master','tempdb','model','msdb')

--
David Portas
SQL Server MVP
--

David Portas
3/12/2004 5:47:48 PM
SELECT catalog_name
FROM information_schema.schemata
WHERE catalog_name NOT IN ('master','tempdb','model','msdb')

The info schema views are specified by ANSI but since ANSI SQL doesn't even
recognise the concept of a "database", let alone a *system* database I think
this is the best you can do.

--
David Portas
SQL Server MVP
--

Robert Smith
3/12/2004 6:28:05 PM
Thanks for your expeditious response. Have a great weekend.

- Bob

*** Sent via Developersdex http://www.developersdex.com ***
David Portas
3/12/2004 6:41:08 PM
Thanks. You too!

--
David Portas
SQL Server MVP
--

[quoted text, click to view]

AddThis Social Bookmark Button