Script to list the users of the databases

Yesterday, one of my clients came up with this requirement to develop a script where in we can list all the users of the databases for reporting purposes at his end. Scripted the following query to help his cause. DECLARE @DBuser_sql VARCHAR(4000) DECLARE @DBuser_table TABLE (DBName VARCHAR(200), UserName VARCHAR(250), LoginType VARCHAR(500), AssociatedRole VARCHAR(200)) SET @DBuser_sql=’SELECT…