all groups > sql server replication > september 2003 >
You're in the

sql server replication

group:

Database owners


Database owners Luis Falch
9/25/2003 11:48:01 AM
sql server replication:
Good moorning ...

I need to retrieve all the database owners in my server by database, and
after that change the owner of all this databases to sa user.

Thanks in advance for you help.

Richard


Re: Database owners Narayana Vyas Kondreddi
9/25/2003 5:11:06 PM
You could run the following statement to find out all the databases that are
not owned by 'sa', and change the owner to sa by using sp_changedbowner.


SELECT name AS DatabaseName, SUSER_SNAME(sid) AS OwnerName
FROM master.dbo.sysdatabases
WHERE SUSER_SNAME(sid) <> 'sa'

--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
What hardware is your SQL Server running on?
http://vyaskn.tripod.com/poll.htm


[quoted text, click to view]
Good moorning ...

I need to retrieve all the database owners in my server by database, and
after that change the owner of all this databases to sa user.

Thanks in advance for you help.

Richard



AddThis Social Bookmark Button