此查询告诉列中的用户/角色名称以及grantee
列中的各种分配权限...auth
where Y
= right present, G
= right present 以及将其授予其他人的权限。
SELECT
grantee,
screator,
stname,
tcreator,
ttname,
updatecols,
alterauth,
deleteauth,
indexauth,
insertauth,
selectauth,
updateauth
FROM
SYSIBM.SYSTABAUTH
WHERE
TTNAME = 'MY_TABLE'
AND TCREATOR = 'MY_SCHEMA'
样本结果集:
|GRANTEE |SCREATOR |STNAME |TCREATOR |TTNAME |UPDATECOLS|ALTERAUTH|DELETEAUTH|INDEXAUTH|INSERTAUTH|SELECTAUTH|UPDATEAUTH|
============================================================================================================================
|MY_SCHEMA|MY_SCHEMA|MY_TABLE|MY_SCHEMA|MY_TABLE| | | G| | G| G| G|
|USER2 |MY_SCHEMA|MY_TABLE|MY_SCHEMA|MY_TABLE| | | Y| | Y| Y| Y|
|USER3 |MY_SCHEMA|MY_TABLE|MY_SCHEMA|MY_TABLE| | | Y| | Y| Y| Y|
|GROUP1 |MY_SCHEMA|MY_TABLE|MY_SCHEMA|MY_TABLE| | | Y| | Y| Y| Y|
|GROUP2 |MY_SCHEMA|MY_TABLE|MY_SCHEMA|MY_TABLE| | | Y| | Y| Y| Y|
|GROUP3 |MY_SCHEMA|MY_TABLE|MY_SCHEMA|MY_TABLE| | | | | | Y| |
|GROUP4 |MY_SCHEMA|MY_TABLE|MY_SCHEMA|MY_TABLE| | | Y| | Y| Y| Y|
SYSIBM.SYSTABAUTH 的 IBM 文档(感谢 @mustaccio)