RSS

Retrieving a list of System databases from SQL Server

07 Aug

I need to get a list of System databases from SQL Server.

A bit of googling provided enabled me to develop this SQL statement:

owner_sid is equal to 0x01 just for system databases. So you can use it to recognise if the database is a system DB or not.

select * from sys.databases
where owner_sid != 0x01

This works, it gives me a list of system databases.

🙂

Advertisements
 
Leave a comment

Posted by on August 7, 2014 in SQL SERVER

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: