Obviously the system databases normally do not have a demand for bulk users and should be excluded from these updates. This is the syntax. This script changes the db owner in all but the system to sa to make sure a user is not the owner.
DECLARE @cmd nvarchar(255);
SET @cmd =
'IF ''?'' NOT IN(''master'', ''model'', ''msdb'', ''tempdb'')
BEGIN USE ? exec sp_changedbowner sa END';
EXEC master.
sys.
sp_MSforeachdb @command1 = @cmd
No comments:
Post a Comment