Friday, January 6, 2017

Msg 8623, Level 16, State 1, Line 1

Msg 8623, Level 16, State 1, Line 1
The query processor ran out of internal resources and could not produce a query plan. This is a rare event and only expected for extremely complex queries or queries that reference a very large number of tables or partitions. Please simplify the query. If you believe you have received this message in error, contact Customer Support Services for more information.

Thursday, January 5, 2017

SQL Server: Database principal owns a schema in the database and cannot be dropped

Got this error today when i was playing around with login and user created selecting different options.

I had check db_datareader and db_datawriter in OwnedSchemas tab in Security >> Logins of the database server. This was causing the error and the fix was to transfer the schema ownership to a different login so we can drop the user we were trying to.

ALTER AUTHORIZATION ON SCHEMA::db_datareader to whome;
ALTER AUTHORIZATION ON SCHEMA::db_datawriter to whome;

Hope this helps someone and Google is my friend 😎