Saturday, February 25, 2012

A question from a newbie

Can somebody tell me the correct syntax if I want to grant SELECT privileges
on all tables in a db?
I tried:
GRANT SELECT TO public;
Thanks.
VenkatAdd the user to the db_datareader fixed database role.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"vvenk" <vvenk@.discussions.microsoft.com> wrote in message
news:A63A543C-1176-4AEF-BC2E-2FBA35D5DB63@.microsoft.com...
> Can somebody tell me the correct syntax if I want to grant SELECT
privileges
> on all tables in a db?
> I tried:
> GRANT SELECT TO public;
> Thanks.
> Venkat|||Geoff:
Thanks a lot. I was reading some of the postings on this forum that
suggested that I have to write a script to cycle through all the tables.
Your's is the most elegant solution.
Venkat
"Geoff N. Hiten" wrote:

> Add the user to the db_datareader fixed database role.
> --
> Geoff N. Hiten
> Microsoft SQL Server MVP
> Senior Database Administrator
> Careerbuilder.com
> I support the Professional Association for SQL Server
> www.sqlpass.org
> "vvenk" <vvenk@.discussions.microsoft.com> wrote in message
> news:A63A543C-1176-4AEF-BC2E-2FBA35D5DB63@.microsoft.com...
> privileges
>
>|||To add to Geoff's response, the built-in db_datareader and db_datawriter
roles are fine if these meet your security requirements. Granting
permissions to individual users or user-defined roles is appropriate when
you need more granular security and/or stored procedure execute permissions.
Utility scripts can be faster than granting permissions via Enterprise
Manager when you have a lot of objects.
Hope this helps.
Dan Guzman
SQL Server MVP
"vvenk" <vvenk@.discussions.microsoft.com> wrote in message
news:2FB6F0F8-D8B8-47B0-8743-DD51C39D4A5E@.microsoft.com...[vbcol=seagreen]
> Geoff:
> Thanks a lot. I was reading some of the postings on this forum that
> suggested that I have to write a script to cycle through all the tables.
> Your's is the most elegant solution.
> Venkat
> "Geoff N. Hiten" wrote:
>

No comments:

Post a Comment