DECLARE @username nvarchar(128) = 'user01';
SELECT COUNT(*) FROM sys.database_permissions
WHERE grantee_principal_id = (SELECT UID FROM sysusers WHERE name = @username)
AND class_desc = 'DATABASE'
AND type='EX'
AND permission_name='EXECUTE'
AND state = 'G';
Result 0
means negative answer, 1
means positive.
No comments:
Post a Comment