473,499 Members | 1,955 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Stored Procedures/ table permissions

Hi, is there any way that I can automate granting user permissions to
tables/ stored procedures in SQL server 2000?

I have a whole bunch of tables and rather than having to right click each
table/ then permissions in Enterprise manager I would like to be able to
iterate through each table object in a database and grant the relevant
permissions.... Same with stored procedures.

Is this possible?? If so, how can I do it

Thanks in advance
Mark
Jul 20 '05 #1
2 5588
Hi all, I have just found a solution to my own problem

http://www.sql-server-performance.co...ecurity_sp.asp

Cheers
Mark
"Mark" <ma**@hotmailNOSPAMTHANKX.com> wrote in message
news:m6**********************@news.xtra.co.nz...
Hi, is there any way that I can automate granting user permissions to
tables/ stored procedures in SQL server 2000?

I have a whole bunch of tables and rather than having to right click each
table/ then permissions in Enterprise manager I would like to be able to
iterate through each table object in a database and grant the relevant
permissions.... Same with stored procedures.

Is this possible?? If so, how can I do it

Thanks in advance
Mark

Jul 20 '05 #2
Mark (ma**@hotmailNOSPAMTHANKX.com) writes:
Hi, is there any way that I can automate granting user permissions to
tables/ stored procedures in SQL server 2000?

I have a whole bunch of tables and rather than having to right click each
table/ then permissions in Enterprise manager I would like to be able to
iterate through each table object in a database and grant the relevant
permissions.... Same with stored procedures.

Is this possible?? If so, how can I do it


SELECT 'GRANT SELECT ON ' + name + ' TO whomever'
FROM sysobjects WHERE type = 'U'

SELECT 'GRANT EXEC ON ' + name + ' TO whomever'
FROM sysobjects WHERE type = 'P'

Cut and paste result. Use Query Analyzer for the operation.

If you want to skip the cut-and-paste part, you could set up a cursor
and use dynamic SQL.
--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #3

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

Similar topics

4
7954
by: TJ Olaes | last post by:
Hello all, this is my second post to this newsgroup. It's a question about stored procedures and permissions and how these behave between databases. Here's the scenario. I have a database that...
1
1424
by: Martin Feuersteiner | last post by:
Dear Group I'm having two stored procedures, sp_a and sp_b Content of stored procedure A: CREATE PROCEDURE dbo.sp_a SELECT * FROM a GO Content of stored procedure B:
6
1654
by: Martin Feuersteiner | last post by:
Dear Group I have found that table A had SELECT permissions for 'Public' but not table B. Giving 'Public' SELECT permissions on table B did the trick. HOWEVER, I don't want anyone to be able...
1
3053
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
1968
by: Brad H McCollum | last post by:
I've looked through many suggestions and partial examples all over this newsgroup and still am not coming up with anything that does specifically what I'm wanting to accomplish. I'm writing a VB...
11
2605
by: Bă§TăRĐ | last post by:
I have been working on this particular project for a little over 2 weeks now. This product contains between 700-900 stored procedures to handle just about all you can imagine within the product. I...
1
9726
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...
45
3358
by: John | last post by:
Hi When developing vb.bet winform apps bound to sql server datasource, is it preferable to use SELECTs or stored procedure to read and write data from/to SQL Server? Why? Thanks Regards
7
3429
by: Dabbler | last post by:
I'm using an ObjectDataSource with a stored procedure and am getting the following error when trying to update (ExecuteNonQuery): System.Data.SqlClient.SqlException: Procedure or Function...
0
7007
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7174
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6894
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
7388
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
4600
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
297
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.