How to check if a user has a permission to run profiler for MSSQL

SELECT has_perms_by_name(null, null, ‘ALTER TRACE’)
EXECUTE AS LOGIN = ‘testUser’;
–Verify the execution context is now login1.
SELECT SUSER_NAME(), USER_NAME();
SELECT has_perms_by_name(null, null, ‘ALTER TRACE’)

REVERT;
–Display current execution context.
SELECT SUSER_NAME(), USER_NAME();

Leave a Reply

Your email address will not be published. Required fields are marked *