Revok guest accounts

  • I ran the following to view all guest accounts on my db:

    EXEC sp_MSforeachdb 'USE [?];

    SELECT * FROM sysusers;'

    GO

    How can I modify this so that it shows me in the result set which database it is referring to?

  • Add DB_NAME() to the SELECT list like this:

    EXEC sp_MSforeachdb 'USE [?];

    SELECT DB_NAME(), * FROM sysusers;'

    Greg

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply