Category: T-SQL

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

If you drop a user that owns a schema, you’ll receive the following error: Drop failed for User ‘my_user’.  (Microsoft.SqlServer.Smo) The database principal owns a schema in the database, and cannot be dropped. (Microsoft SQL Server, Error: 15138) so, to drop user, you have to find which schemas assigned to, and then transfer the ownership […]

Read more

Cannot truncate table ‘dbo.TableName’ because it is being referenced by a FOREIGN KEY constraint.

Impossibile troncare una tabella quando vi è un vincolo di integrità referenziale Spesso vi sarà capitato di ottenere il seguente messaggio di errore in SQL Server 2005 / 2008 Cannot truncate table ‘dbo.TableName’ because it is being referenced by a FOREIGN KEY constraint. nel momento in cui avete tentato di eseguire una TRUNCATE TABLE. Come […]

Read more