473,396 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Stored procedure to grant all users db_owner

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
Jul 20 '05 #1
1 13400

"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
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Brad H McCollum | last post by:
I'm writing an application using VB 6.0 as the front-end GUI, and the MSDE version of SQL Server as the back-end (it's a program for a really small # of users --- less then 3-4). I'm trying to...
1
by: db55 | last post by:
I have some users that I need to run stored procedures, but they can't seem to run them unless they are in the db_owner role of the database. How do I give them access to run the stored procs...
4
by: nishi57 | last post by:
I hope I can get some help regarding this issue, which has been going on for a while. I have a desktop user who is having problem running "Stored Procedures". The DB2 Connect application works fine...
2
by: traceable1 | last post by:
In SQL 2005 (we use Enterprise 64-bit SP2), the users cannot see the text of the stored procedures, functions, etc. This is a production database, so I cannot give them rights to modify them,...
0
by: HJ | last post by:
Hi all, I am experiencing a weird issue and I hope you can help. We are using a Microsoft Access 2003 project (.ade) with an SQL Server 2000 database. One form contains a list box with the...
6
by: HJ | last post by:
Hi all, I am experiencing a weird issue and I hope you can help. We are using a Microsoft Access 2003 project (.ade) with an SQL Server 2000 database. One form contains a list box with the...
0
by: svgeorge | last post by:
I want to update several tables using one stored procedure. How can i do this I mean the syntax.etc. declaration etc. I know the basic syntax as below CREATE PROCEDURE <Procedure_Name, sysname,...
0
by: SOI_0152 | last post by:
Hi all! Happy New Year 2008. Il hope it will bring you love and happyness I'm new on this forum. I wrote a stored procedure on mainframe using DB2 7.1.1 and IBM language c. Everything works...
2
by: acw | last post by:
On a SQL Server 2000 db I would like to setup a stored procedure that accesses couple tables and runs the extended stored procedure xp..cmdshell. The goal is to grant users with limited privileges...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.