By 8 Ottobre 2015

The database principal owns a schema in the database, and cannot be dropped. (Microsoft SQL Server, Error: 15138)

L’errore : The database principal owns a schema in the database, and cannot be dropped. (Microsoft SQL Server, Error: 15138)

The database principal owns a schema in the database, and cannot be dropped

si verifica quando si cerca di cancellare un utente che appartiene ad uno schema.
Per risolvere il problema è possibile

1) Eseguire una SELECT per trovare gli schemi connessi all’utente :
SELECT name FROM sys.schemas WHERE principal_id = USER_ID(‘myUser’)
dove ‘myuser’ è il nostro utente.
Una volta individuati gli schemi si può modificare ognuo di essi con la seguente istruzione:
ALTER AUTHORIZATION ON SCHEMA::SchemaName TO dbo
GO
DROP USER myUser

2) Utilizzare management Studio
– Object Explorer >> Espandere il [databasename] >> Sicurezza.
– Cliccare su Schemi.
– Nella finestra di proprità verificare l’utente di appartenenza. Modificare l’utente o cancellare lo schema
– Se ci sono schemi “system” consiglio di modificare l’utente in ‘dbo’
– Cancellare l’utente

The database principal owns a schema in the database, and cannot be dropped Microsoft SQL Server Error: 15138, Microsoft SQL Server Error 15138, Impossibile eseguire Elimina per Utente,

Posted in: Sql Server

About the Author:

shared on wplocker.com