Home Forums Article Discussions Article Discussions by Author Discuss content posted by Riken Patel Change DB Owner to sa for multiple DB's RE: Change DB Owner to sa for multiple DB's
Ernest Libertucci
Ten Centuries
Points: 1394
More actions
April 26, 2013 at 7:13 am
#1610345
use master
go
exec sp_msforeachdb 'USE ?;if not exists (select 1 from sys.databases where owner_sid = 0x01 and name = db_name()) exec sp_changedbowner ''sa'''