Drop User from SQL Server Database?

sql, sql-server, user-management

Solution

Is this what you are trying to do??

IF  EXISTS (SELECT * FROM sys.database_principals WHERE name = N'username')
DROP USER [username]

If you are using SQL Server Management Studio you can browse to the user and right-click selecting delete.

Problem

How can I drop user from a database without dropping it's logging? The script should check if the user exists in database, if does then drop the user.

Original source