I'm using SQL Server 2016
I have a basic stored procedure using execute as that I would like to run, but it comes up with this error when I try (names have been anonymised):
Msg 15404, Level 16, State 19, Procedure usp_executeastest, Line 0 [Batch Start Line 2]
Could not obtain information about Windows NT group/user 'MyCompany\A.Smith', error code 0x54b.
Here is my stored proc:
CREATE PROCEDURE [dbo].[usp_executeastest] WITH EXECUTE AS 'dbo' AS BEGIN SELECT * FROM [dbo].[TestTable1] END
Now the database user 'dbo' is mapped to login 'MyCompany\A.Smith' so this explains why the error message mentions MyCompany\A.Smith.
I have tried running this proc by logging in as various users, including logging in as 'MyCompany\A.Smith' who is mapped to the dbo user, and the same error message comes up every time.
So why can't any user run this stored proc?