can someone tell me why these two queries will not work please

  • --Return database-level permissions for user.

    SELECT su.name, dp.class_desc,dp.permission_name, dp.state_desc

    FROM sys.database_permissions dp

    JOIN sys.sysusers su

    ON su.uid = dp.grantee_principal_id

    WHERE dp.grantee_principal_id = DATABASE_PRINCIPAL_ID(shantecostello);

    --Return rolememberships for the user

    SELECT su1.name as[User], su2.name as [Role]

    FROM sys.database_role_members drm

    JOIN sys.sysusers su1

    ON su1.uid = drm.member_principal_id

    JOIN sys.sysusers su2

    ON su2.uid = drm.role_principal_id

    WHERE su1.name = williamcostello

  • mrwillcostello (3/26/2012)


    --Return database-level permissions for user.

    SELECT su.name, dp.class_desc,dp.permission_name, dp.state_desc

    FROM sys.database_permissions dp

    JOIN sys.sysusers su

    ON su.uid = dp.grantee_principal_id

    WHERE dp.grantee_principal_id = DATABASE_PRINCIPAL_ID(shantecostello);

    --Return rolememberships for the user

    SELECT su1.name as[User], su2.name as [Role]

    FROM sys.database_role_members drm

    JOIN sys.sysusers su1

    ON su1.uid = drm.member_principal_id

    JOIN sys.sysusers su2

    ON su2.uid = drm.role_principal_id

    WHERE su1.name = williamcostello

    Might be a few missing quotes.

    --Return database-level permissions for user.

    SELECT su.name, dp.class_desc,dp.permission_name, dp.state_desc

    FROM sys.database_permissions dp

    JOIN sys.sysusers su

    ON su.uid = dp.grantee_principal_id

    WHERE dp.grantee_principal_id = DATABASE_PRINCIPAL_ID('shantecostello');

    --Return rolememberships for the user

    SELECT su1.name as[User], su2.name as [Role]

    FROM sys.database_role_members drm

    JOIN sys.sysusers su1

    ON su1.uid = drm.member_principal_id

    JOIN sys.sysusers su2

    ON su2.uid = drm.role_principal_id

    WHERE su1.name = 'williamcostello'

  • Thank you.

  • good queries

Viewing 4 posts - 1 through 3 (of 3 total)

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