Re: Grant select permission on all Tables to a DB role
From: Adam Machanic (amachanic_at_hotmail._removetoemail_.com)
Date: 08/06/04
- Next message: Dave: "How to expose SQL Server on internet?"
- Previous message: SangHunJung: "Grant select permission on all Tables to a DB role"
- In reply to: SangHunJung: "Grant select permission on all Tables to a DB role"
- Next in thread: Tom Moreau: "Re: Grant select permission on all Tables to a DB role"
- Reply: Tom Moreau: "Re: Grant select permission on all Tables to a DB role"
- Reply: SangHunJung: "Re: Grant select permission on all Tables to a DB role"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Fri, 6 Aug 2004 12:01:00 -0400
There might be another way, but you could use the sp_msforeachtable sproc.
Please note that it's undocumented/unsupported, so insert usual warnings
here (don't rely on it in production code or expect it to be there in the
next release, etc, etc.)
But I digress....
sp_msforeachtable 'grant select on ? to my_role'
Will grant select on every table in the current database to my_role.
Here is an article with more info on that sproc and another related sproc,
sp_msforeachdb:
http://www.dbazine.com/larsen5.shtml
"SangHunJung" <SangHunJung@discussions.microsoft.com> wrote in message
news:CF69101B-4AE0-4C38-9466-FDCFE5818569@microsoft.com...
> Hello,
> I got Win2k Advanced Server with SQL 2K running.
> I am trying to figure out one single query will give a permission to all
> tables under a database. A database has 20 - 30 tables with several
custom
> roles and it is pain to run a query that give a permission on one table at
a
> time.
> Grant select on my_table to my_role
> Grant update on my_table1 to my_role1
> Can any one turn a light for me on this??
>
> Thanks in advance.
> SangHun
- Next message: Dave: "How to expose SQL Server on internet?"
- Previous message: SangHunJung: "Grant select permission on all Tables to a DB role"
- In reply to: SangHunJung: "Grant select permission on all Tables to a DB role"
- Next in thread: Tom Moreau: "Re: Grant select permission on all Tables to a DB role"
- Reply: Tom Moreau: "Re: Grant select permission on all Tables to a DB role"
- Reply: SangHunJung: "Re: Grant select permission on all Tables to a DB role"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|