Re: sp_revokedbaccess

From: Lisa (anonymous_at_discussions.microsoft.com)
Date: 12/31/03


Date: Wed, 31 Dec 2003 08:18:46 -0800

Here is the code, the primary difference being the
existence of @error:

CREATE procedure sp_RevokeDBAccess
        @name_in_db sysname,
        @error int OUT
as
        Set @error = 0
-- SETUP RUNTIME OPTIONS / DECLARE VARIABLES --
        set nocount on
        declare @uid smallint,
                    @ret int
-- CHECK PERMISSIONS --
    if (not is_member('db_accessadmin') = 1) and
       (not is_member('db_owner') = 1)
        begin
          Set @error = 15000
--print '@error = ' + convert ( varchar (6), @error )
          return (1)
        end
-- DISALLOW USER TRANSACTION --
        set implicit_transactions off
        IF (@@trancount > 0)
        begin
          Set @error = 15002
--print '@error = ' + convert ( varchar (6), @error )
          return (1)
        end
-- CHECK IF SYSUSER EXISTS --
            select @uid = uid from sysusers where name =
@name_in_db
               and (issqluser = 1 or isntname =
1) -- is droppable entity
               and (name <> 'guest' or hasdbaccess =
1) -- special case guest
            if @uid is null
              begin
            Set @error = 15008
-- print '@error = ' + convert ( varchar (6),
@error )
            return (1)
              end

        if @error = 0
          begin
            exec @error = sp_revokedbaccess @name_in_db
          end
GO



Relevant Pages

  • Re: Oracle Text Index Error DRG-11513
    ... I've run a script to test for the existence of those files (using ... Toad). ... DECLARE ... Re-checked the permissions and no reason for error found there. ...
    (comp.databases.oracle.server)
  • Re: [OT] Ghost icon on server
    ... with PHP. ... They have the same permissions as all the other files ... that really have full existence. ... helpful) bods can see what Apache lists? ...
    (alt.html)
  • Re: FreeBSD 5.2 & OpenOffice 1.1
    ... Permissions. ... Existence. ... HTH, ... Kevin Kinsey ...
    (freebsd-questions)