Rasolo
Search

Start | Blogs | IT | Delete user SQL

2020-06-05

IT

How to delete an undeleteable user in SQL Server

I was not able to delete a user in my SQL Server. The error message that was thrown was something like: "Can not alter user dbo". The user had previously had a membership connection to a database.


The solution was to temporarily detach the previous database in order to delete the user from SQL server.

  • Right click the database
  • Tasks
  • Detach
  • Check the "Drop connections" box
  • Click Ok
  • Right click the user under Security -> Logins for SQL Server
  • Delete the user

 

After that I could restore the database and re-add the user to it.

In order to reattach the database:

  • Right click "Databases" under SQL Server
  • Attach
  • Add
  • Select the database you had detached
  • Click ok

Comments