Thanks for the info. But I seem to have problems with the results. To test this stored proc, I have created a user and given it specific rights to several databases. Now when I execute the code all I get is the grant user to login. None of the database rights appear.
Is this correct?