SQL Stuff

Find Database Owners Across All Databases

Here’s some SQL logic to get the database owner across all databases ( not the specifically the db_owner right or schema dbo ), but the designated database owner name attached to the database. I’ve also taken the liberty of adding human readable time when the databases were created.

'database name'	= db_name(database_id)
,	'owner name' = suser_name(owner_sid)
,	'database created'	= datename(dw, create_date) + ' ' + convert(char, create_date, 9) from
order by
db_name(database_id) asc

Categories: SQL Stuff

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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s