Database Scripts

Beta
 Log In    |   Sign Up

SQL Server : Change The Owner of A SQL Server Database

Added on Jan-30-2012 by sqlservermo
For SQL Server

Tags : ownerownershipusers

This scripts changes the ownership of all non-system databases on a SQL Server instance to the 'sa' user.

Versions

SQL Server 2005+

DOWNLOAD

EXEC sp_MSForEachDB
 'Use ?;IF DB_ID() > 4 AND DB_NAME() <> ''distribution'' EXEC sp_changedbowner ''sa'''

    

Report Script

blog comments powered by Disqus