Query Result Modification !

  • The Query,

    SELECT OBJECT_NAME(id) as ObjectName,

     USER_NAME(uid) as UserName, protecttype,

     action, USER_NAME(grantor) as Grantor

    FROM sysprotects

    WHERE id = object_id('syslogins')

    The above query will give me output like this=>

    ObjectNameUserNameProtectTypeActionGranter
    sysloginspublic205193dbo
    sysloginspublic206193dbo
    sysloginsperfstat205193dbo

    but i want some replacement as

    GRANT instead of 205
    REVOKE instead of 206
    SELECT instead of 193

    i.e output will look like as =>

    ObjectNameUserNameProtectTypeActionGranter
    sysloginspublic

    GRANT

    SELECT

    dbo
    sysloginspublic

    REVOKE

    SELECT

    dbo
    sysloginsperfstat

    GRANT

    SELECT

    dbo

     

    Is it possible..?

    I will be Heartly Thankful for Any Help....

  • Hello,

    You could build a tiny table with the translations to join with. Since the values are hardcoded in INFORMATION_SCHEMA.TABLE_PRIVILEGES it isn't likely that the translationtable is already there.

    If you lookup sysprotects in the bookonline it gives you (most of) the possible values

  • Or use a case statement if there are not too many values.

     

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

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