SQL Server: EXECUTE AS clause of stored procedure not granting sysadmin permissions
问题 I developped a stored procedure in order to restore a database from a backup file and add an application user to it. This stored procedure belongs to the master database. The issue is that my IT department does not allow me to use an admin user, only to use an EXECUTE AS statement with a sysadmin user. I can restore the database but I can't find a way to add the user at the end of the process. The code I use: CREATE PROCEDURE [dbo].[myProc] @database VARCHAR(50) WITH EXECUTE AS 'aSysAdminUser