how to grant select to public for all tables and views
Posted on 2007-10-04
i'd like to grant public select access to all tables and views. Can i do this automatically? THe SQL below generates the statements that in turn will do the job, but how do i then execute these statements automatically, or maybe there is a simpler way? The tables/views get re-created daily, so i need to do this also daily.
select 'grant select on ' + name + ' to public'
FROM (select name from sysobjects where (xtype='U' or xtype='V') and name not like '%load') as Tbls
order by name