How to Find Out Owner of Any Database in SQL Server - SQL Server DBA Tutorial

In this video you will learn how to find out owner of any database in SQL Server instance? you will learn following ways to accomplish this task.
1- How to find owner of any database in SQL Server using Store Procedure
2- How to find owner of any database in SQL Server using System views

Scripts:

--Finding owner of database using Store Procedure
sp_helpdb

--Finding out Owner of databse using sysdatabses system view 
select name as DatabaseName,SUSER_SName(sid) as Database_Owner from sysdatabases

--Where name = 'Your desired database name'

--Finding owner of database using sys.databases system view
Select name as DatabaseName, SUSER_SNAME(Owner_sid) as Database_Owner from sys.databases
--Where name = 'Your desired database name'



How to Find Out Owner of Any Database in SQL Server - SQL Server DBA Tutorial

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.