"Tyler Smith Watu" <wa********@yahoo.co.nz> wrote in message
news:2f**************************@posting.google.c om...
I am trying to come up with a stored procedure to grant all users
db_owner role (rather than have to manually check the users each
time)
Thanks in advance for your help
TY
One way is to execute the output of a query like this (see "sysusers" in
Books Online):
select 'exec sp_addrolemember ''db_owner'', ''' + name + ''''
from sysusers
where (isntuser = 1 or issqluser = 1)
and name not in ('dbo', 'guest')
You should be able to convert that to a cursor if you want to run it in a
procedure. If you're using Windows security, it would probably be easier to
manage access through a Windows group.
Simon