/* this query grants permission to the accounting group for all tables and views in the database from which it is launched */ declare @objid int /* the object id of the table */ declare @objname char(30) /* string to build up table name */ declare addkey cursor for select distinct name from sysobjects where type in ('U','V') /* tables and views */ open addkey fetch next from addkey into @objname while @@fetch_status = 0 begin select @objid = object_id(@objname) EXEC ("grant select on " + @objname + " to accounting") /* replace accounting with your user/group name */ fetch next from addkey into @objname end deallocate addkey