Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Principle dbo does not exist in Sql Server

While fetching data through a stored procedure in SQL Server I am getting error like

Cannot execute as the database principal because the principal "dbo" does not exist, this type of principal cannot be impersonated, or you do not have permission.

I am getting this error only for accessing a particular stored procedure, not for all SP's.

like image 873
Nimmi Avatar asked May 23 '16 07:05

Nimmi


2 Answers

Give your database a valid owner. Try this:

ALTER AUTHORIZATION 
ON DATABASE::[YourDatabaseName]
TO [LoginUser];

or you can try to set it like

USE [dbname]
GO
sp_changedbowner 'someLogin'
like image 119
Rahul Tripathi Avatar answered Sep 29 '22 01:09

Rahul Tripathi


ALTER AUTHORIZATION ON DATABASE::Example TO sa;
like image 20
Vishe Avatar answered Sep 29 '22 00:09

Vishe