Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Links Database Forum

» Database Journal Home
» Database Articles
» Database Tutorials
MS SQL
Oracle
DB2
MS Access
MySQL
» RESOURCES
Database Tools
SQL Scripts & Samples
Links
» Database Forum
» Sitemap
Free Newsletters:
DatabaseDaily  
News Via RSS Feed


follow us on Twitter
Database Journal |DBA Support |SQLCourse |SQLCourse2
 

Featured Database Articles

SQL Scripts & Samples

Posted Jan 12, 2003

Simple Grants Cursor Script

By DatabaseJournal.com Staff



Here's a simple cursor script that will look for User objects and grant access to a user or group. The script could also be adapted to perform a REVOKE command rather than a GRANT privilege. It's really an admin tool, but you could use it to trigger or limit a Database user's application privileges. Really you would want to first examine the Application Role set-up in SQL 2000 to promote and demote a SQL User's privileges.

Here's an example to demonstrate adding permissions to a database user under SQL 7/2000:

Author: Jack C. Donnell


GRANT 
    { ALL [ PRIVILEGES ] | permission [ ,...n ] } 
    { 
        [ ( column [ ,...n ] ) ] ON { table | view } 
        | ON { table | view } [ ( column [ ,...n ] ) ] 
        | ON { stored_procedure | extended_procedure } 
        | ON { user_defined_function }
    } 
TO security_account [ ,...n ] 
[ WITH GRANT OPTION ] 
[ AS { group | role } ] 

and one for performing a revoke command: 
REVOKE [ GRANT OPTION FOR ] 
    { ALL [ PRIVILEGES ] | permission [ ,...n ] } 
    { 
        [ ( column [ ,...n ] ) ] ON { table | view } 
        | ON { table | view } [ ( column [ ,...n ] ) ] 
        | ON { stored_procedure | extended_procedure } 
        | ON { user_defined_function } 
    } 
{ TO | FROM } 
    security_account [ ,...n ] 
[ CASCADE ] 
[ AS { group | role } ] 



Disclaimer: We hope that the information on these script pages is valuable to you. Your use of the information contained in these pages, however, is at your sole risk. All information on these pages is provided "as -is", without any warranty, whether express or implied, of its accuracy, completeness, or fitness for a particular purpose... Disclaimer Continued

Back to Database Journal Home



SQL Scripts & Samples Archives

Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 




Latest Forum Threads
SQL Scripts & Samples Forum
Topic By Replies Updated
sql help!! add 1 August 22nd, 11:58 AM
How To Combine These 2 Queries into 1 Query ? tarek_land 1 June 7th, 08:37 AM
solving query svibuk 1 February 3rd, 06:08 AM
converting from a character string to uniqueidentifier saturnius 4 January 4th, 05:56 AM


















Thanks for your registration, follow us on our social networks to keep up-to-date