Created
October 17, 2012 11:56
-
-
Save q42jaap/3905150 to your computer and use it in GitHub Desktop.
Login corrupted after database backup restore from different server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE dbname; | |
SELECT s.name | |
FROM sys.schemas s | |
WHERE s.principal_id = USER_ID('username'); | |
ALTER AUTHORIZATION ON SCHEMA::db_owner TO dbo; | |
-- from http://blog.sqlauthority.com/2011/12/26/sql-server-fix-error-15138-the-database-principal-owns-a-schema-in-the-database-and-cannot-be-dropped/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment