Re: Please help with deleting a user.



Al (Al@xxxxxxxxxxxxxxxxxxxxxxxxx) writes:
I created a <log in> in sql server 2005. When I tried to delete the log
in, it gave me a message that to complete the process I should delete
the users (belonging to this log in) in each databse, it also said that
it may be necessary to transfer the ownership of the schemas to new
users. I tried doing that using:

ALTER AUTHORIZATION ON SCHEMA::dbo TO guest;

it says that it can not alter "dbo" schema.

My user that I am trying to delete is "DrawingReview" (it is a generic
name for my applicatin) and when I click on the properties of this user
it shows that the user owns "dbo" schema.

First, some terminology:

A *login* is a server-level entity. A *login* may map to a *user* in one
or more databases. The name the of the server login and database user
can be the same, but they don't have to. And there is a very special
case, where they are not: the login is the owner of a database. In
that case, the login always maps to the database user dbo.

I don't why it said that DrawingRewiew as the owner of the dbo schema.
The dbo schema is always owned by the dbo user. Possibly
DrawingReview was the database owner, but I don't think you can
drop logins that owns databases.

Just use DROP USER DrawingReview to drop the user. If the user owns
schemas you will be told. If the user was created with sp_adduser,
there will be a schema DrawingReview as well. You may want to drop
that schema, if there are no objects in it.




--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

.