Tag: drop user sql


The database principal owns a database role and cannot be dropped.

select DBPrincipal_2.name as role, DBPrincipal_1.name as owner
from sys.database_principals as DBPrincipal_1 inner join sys.database_principals as DBPrincipal_2
on DBPrincipal_1.principal_id = DBPrincipal_2.owning_principal_id

 

SELECT DP2.name, DP1.name FROM sys.database_principals AS DP1
JOIN sys.database_principals AS DP2
ON DP1.owning_principal_id = DP2.principal_id
WHERE DP1.type = ‘R’ AND DP2.name = ‘WLS-ADM-IS';

ALTER AUTHORIZATION ON ROLE::rolename TO dbo;

 

Referensi:

http://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/6bdaa0a2-945f-42af-b0e2-d2c714e43f46/

http://www.codeproject.com/Articles/66827/Few-Step-s-to-Remove-SQL-Server-Database-User-s