User's With Access

  • Hello,

    I would like to see a list of users that have access to only a certain database, but not access to other databases. I am curious if anyone has a way to do this? This is a SQL 2000 server.

    I guess the query would be similar to what is used to populate the GUI display when looking at a users properties to show what databases they have access to.

    Thanks,

    Brian

  • A little more information...

    This appears to be the query running in the background...for each database

    SELECT u.name AS [Name],

    CAST(u.hasdbaccess AS bit) AS [HasDBAccess]

    FROM dbo.sysusers AS u

    WHERE (((u.issqlrole != 1 and u.isapprole != 1 )

    or (u.sid=0x00))

    and u.isaliased != 1

    and u.hasdbaccess != 0)

    and(ISNULL(suser_sname(u.sid),N'')=N'USERNAME')

    What would be a good way to get this into a query that only returns users with access to one db and no others?

    Thanks

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

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