Query to find the users and their persmissions in SQL Server Database

This query returns the users and their permissions in a database:

SELECT u.name as user_name, p.state_desc, p.permission_name
FROM sys.server_permissions AS p JOIN sys.server_principals AS u
ON p.grantee_principal_id = u.principal_id