Click to See Complete Forum and Search --> : Granting permission to all tables, sp's


yaronkl
December 1st, 2003, 10:53 AM
Hi

I have a user who has no permissions to any object in a given database. if I double click on DBNAME\Users\UserName and press the Permission button, all checkboxes for all tables, stored procedures views etc. are blank.
I want the user to have SELECT,INSERT,UPDATE,DELETE permission to all tables, and EXECUTE permission to all stored procedures.
The GRAT sql command does that, but it does it per object, and I have thousands of tables and stored procedures.
Can anyone adivse of a way of granting permissions to all objects easiliy?

Thanks

raghupathys
December 2nd, 2003, 06:32 AM
you can assign the user datareader and datawriter roles for the given db, that way the user can perform any dml statements on any object in the give database

yaronkl
December 2nd, 2003, 10:55 AM
thanks. I tried what you suggested, but it did not work.
I guess normally it should, but in my case i think there is something wrong.

buser
December 18th, 2003, 03:48 AM
for each table....
use master
go
exec sp_MSforeachtable 'GRANT SELECT,INSERT,UPDATE,DELETE ON ? TO USERNAME'
go

Alter it for itself:
use master
go
exec sp_helptext 'sp_MSforeachtable'
go