April 30, 2009 at 6:00 am
Hi All,
Is there any script whereby i can get a list of db and the owner ie who created it? I want the same user when i right click on a db to check the owner.
I tried the below
select a.name, a.create_date, b.name from sys.databases a
inner join syslogins b on a.owner_sid =b.sid
But it omits some of the db.
Can someone please help.
Thanks
A.
April 30, 2009 at 6:14 am
Try customizing the results of system stored procedure run against master database
use master
sp_helpdb
-:-)
Cheer Satish 🙂
April 30, 2009 at 7:08 am
SELECT
[name]AS [DBName]
,SUSER_SNAME([sid])AS [DBOwner]
FROM [master].[dbo].[sysdatabases]
ORDER BY 1
April 30, 2009 at 7:09 am
sp_helpdb
[font="Comic Sans MS"]+++BLADE+++[/font]:cool:
April 30, 2009 at 1:30 pm
Adam Bean (4/30/2009)
SELECT
[name]AS [DBName]
,SUSER_SNAME([sid])AS [DBOwner]
FROM [master].[dbo].[sysdatabases]
ORDER BY 1
this should do it
select [name] as [DB Name], SUSER_SNAME([owner_sid]) AS [DBOwner] from sys.databases
order by 1
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" 😉
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply