• Great script.

    2 things.

    1. Proper version handling.

    The version expresssion should be handled as this:

    CAST((LEFT(CAST(Serverproperty('ProductVersion') AS VARCHAR(2)),

    2)) AS INT)

    Then it will work for SQL 2008 and up

    2. Database names should be bracketed "[" and "]" to handle spaces and dashes in the database names.

    But the idea is awesome. It gives plenty of login/user/role info that is difficult to collect othewise.

    Good idea for a report too.

    Thanks

    Alex Donskoy

    SQL Server DBA Greenberg & Trauriq PA, Miami FL