Chapter 3 DBMS Reference Guide


SqlPermQuery

SQL Query to reverse engineer permissions granted on tables.

Example

In Sybase Adaptive Server Enterprise 12.5:

{ select u1.name grantee, 
case 
    when (s.action = 193) then 'SELECT'
    when (s.action = 195) then 'INSERT'
    when (s.action = 196) then 'DELETE'
    when (s.action = 197) then 'UPDATE'
end +
case
    when (s.protecttype = 0) then '+'
    when (s.protecttype = 1) then ''
    when (s.protecttype = 2) then '-'
end
|| ','
from sysprotects s, sysusers u, sysusers u1, sysobjects o
where 
  o.name = %.q:TABLE% and
  o.uid = u.uid and
  s.id = o.id and
  u1.uid = s.uid

 


Copyright (C) 2005. Sybase Inc. All rights reserved.