Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Old Forums
 CLOSED - General SQL Server
 How to Drop User Login

Author  Topic 

erikkl2000

15 Posts

Posted - 2006-08-06 : 15:41:21
Hi,

I am trying to drop a user login from my database and i can not get this drop to happen with out an exception. For example when i try to remove the user mappings and click ok i get an exception of:::

TITLE: Microsoft SQL Server Management Studio
------------------------------

Drop failed for User 'dbo'. (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.2047.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Drop+User&LinkId=20476

------------------------------
ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

------------------------------

Cannot drop the user 'dbo'. (Microsoft SQL Server, Error: 15150)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.2047&EvtSrc=MSSQLServer&EvtID=15150&LinkId=20476

------------------------------
BUTTONS:

OK
------------------------------

i have tried to reproduce this error by creating another user and mapping its username to databases and then unmap and there is not problem.. What do i do?

erik



EXEC sp_changedbowner 'UserLogin'

nr
SQLTeam MVY

12543 Posts

Posted - 2006-08-06 : 16:42:59
You are trying to drop dbo?

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

erikkl2000

15 Posts

Posted - 2006-08-06 : 16:49:53
Yes
Go to Top of Page

erikkl2000

15 Posts

Posted - 2006-08-06 : 16:57:01
That error accrues when i try to remove a user mapping...
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2006-08-06 : 18:21:15
You can't drop dbo - it is the databae owmner.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

erikkl2000

15 Posts

Posted - 2006-08-06 : 20:32:13
I know this is an easy one but i have just resently started really paying attention to things like users and roles..

When i right click on a user at server level i get the propertys for that user. Now i try to remove the user mapping from a table and i get this error.. So what i have done is create a database under this username and now i can not remove the mappings from this user for that reason?

erik
Go to Top of Page

erikkl2000

15 Posts

Posted - 2006-08-06 : 21:14:56
Here is a photo of my enviroment as i walk through these six steps

http://www.constructionsupercenter.com/Help/Sql/HowTo-Remove-UserLogin-sql.jpg

1. Select User
2. Right click for propertys
3. Choose User Mappings
4. Remove User Mappings
5. Click Ok
6. Recieve execption
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2006-08-06 : 21:55:41
what i have done is create a database under this username and now i can not remove the mappings from this user for that reason?

I suspect that is the case. The user will be the database owner. You will need to make someone else the database owner (sp_changedbowner) then maybe you can remove the user.
Bit surprised you get that error for this though.

If that doesn't fix it look at master..syslogins and db..sysusers to check the sid mappings.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -