Permissions on Objects

  • Grant permissions to a role rather than a user and then assign users to the role.  A user is more likely to leave than a role is to become obsolete.

    USE MyDatabase

    GO

    DECLARE @sProcName SysName

    SET @sProcName = ''

    WHILE @sProcName IS NOT NULL

     BEGIN

      SELECT @sProcName = MIN(Name)

      FROM SysObjects

      WHERE Type='P' AND

      Name > @sProcName AND

      Name LIKE 'usp%'

      PRINT @sProcName

      IF @sProcName IS NOT NULL

       EXEC('GRANT EXEC ON ' + @sProcName + ' TO MYROLE')

     END

     

  • Thanx David

     


    Kindest Regards,

    dullah

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

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