magritton
10/27/2015 - 5:50 PM

Creates a user in all of the databases in an instance and then adds the user to the DB owners role

Creates a user in all of the databases in an instance and then adds the user to the DB owners role

EXEC master.dbo.sp_MSforeachdb  'USE [?]; CREATE USER SVCSPTimer FROM login [SCU\SVCSPTimer]'
EXEC master.dbo.sp_MSforeachdb  'USE [?]; EXEC sp_addrolemember N''db_owner'', N''SVCSPTimer'';'