Cannot execute as the database principal because the principal "username" does not exist, this type of principal cannot be impersonated, or you do not have permission.I am going to read your mind now.
- You recently backed up your database copy-only and moved it to another server or development box.
- You're attempting to perform an "Execute As..." command.
- Your software has been running for some time and this new error just started cropping up after you "refreshed" your copy of the database (from production?).
- You looked at the server logins, and the database users, and they seem to match (there is a login with the same name as the user).
What you need to do is re-create the user in the database (and reassign any roles and permissions).
USE [myDB]
GO
/****** Object: User [myUser] Script Date: 01/14/2013 18:21:22 ******/
IF EXISTS (SELECT * FROM sys.database_principals WHERE name = N'myUser')
DROP USER [myUser]
GO
USE [myDB]
GO
/****** Object: User [myUser] Script Date: 01/14/2013 18:21:22 ******/
GO
CREATE USER [myUser] FOR LOGIN [myUser] WITH DEFAULT_SCHEMA=[dbo]
GO
...
Bryan Valencia is a contributing editor and founder of Visual Studio Journey. He owns and operates Software Services, a web design and hosting company in Manteca, California.
No comments:
Post a Comment