GRANT I/U/D/S on Newly Created Tables and SPs

  • Basic request here:   I need T-SQL to GRANT INSERT, UPDATE, DELETE, SELECT on all user TABLES and EXECUTE on all user SPs created after 3/1/2006.

    thx in advance

    BT
  • declare @group varchar(128)

    set @group = 'mygroup'

    select 'Grant '+ Case when xtype = 'U' then 'INSERT, UPDATE, DELETE'

                     else 'EXECUTE' end + ' ON ' + name + ' TO ' + @group

    from sysobjects

    where

     xtype in( 'U','P')

        and crdate> '20050101'

        and ObjectProperty(id,'IsMSShipped') = 0

     


    * Noel

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply