DROP Database User Fails

  • I am unable to drop a certain DB User from a DB. I have tried to drop the DB user explicitly. I have also tried to remove the DB user from the sql login and both attempts yeild the error:

    The database principal is set as the execution context of one or more procedures, functions, or event notifications and cannot be dropped. (Microsoft SQL Server, Error: 15136)

    I have run the query: "select * from sys.sql_modules where execute_as_principal_id = user_id('')" with the database username and no Execute As principals are returned for this user. There are also no schemas associated with the user.

  • Run this query:

    select * from sys.event_notifications

  • Tried "select * from sys.event_notifications"; it returned no rows!

  • Is the user an owner of any schema's in the database?

  • Does this user own to db_owner schema. according to your text, it sounds it does...

    you will have to transfer the db_owber/dbo to some other user and then the user can be deleted.

  • The DB User is not the DB owner (my AD account is) and has no schemas. I was able to remove all of its roles and it became disabled as soon as i did. I still get the error message when trying to DROP however.

  • Service Broker!

    The database user had created some routes, services, queues, etc.

    They were no longer used, deleted them and the user could be removed.

  • Try user mapping and uncheck the databases

  • Hi Raymond, i am having the exact same problem. How and where did you manage to locate the information through the servcie broker? It's doing my nut in!:w00t:

Viewing 9 posts - 1 through 8 (of 8 total)

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