I am practicing few question for exam and I got this doubt.
Question:
You administer a Microsoft SQL Server 2012 database that has Trustworthy set to On. You create a stored procedure that returns database-level information from Dynamic Management Views. You grant User1 access to execute the stored procedure. You need to ensure that the stored procedure returns the required information when User1 executes the stored procedure. You need to achieve this goal by granting the minimum permissions required. What should you do?
One of the given answer is:
Modify the stored procedure to include the EXECUTE AS OWNER statement.
Grant VIEW SERVER STATE permissions to the owner of the stored procedure.
Doubt:
I added EXECUTE AS OWNER to the stored procedure. When I check the owner of this Stored Procedure, It shows dbo (from alt + F1). When I execute below code to grant permission to the owner, it is showing error that Cannot find the login dbo.
USE [master]
GO
GRANT VIEW SERVER STATE TO [dbo]
What am I missing?