Get permissions for stored procedure in sybase
-
28-09-2019 - |
Question
How do I get the granted permissions for a stored procedure in sybase?
Solution
It depends on the form that you want that info in.
- If you are writing SQL for some internal purpose, and you need that info as data for it, Kolchanov's answer is correct.
- If you are merely performing DBA functions, then any number of DBA GUI tools (SybaseCentral comes with the CD; DBArtisan is much better) provide that info via an explorer window and clicks
- If you only have character based access, use
sp_helprotect proc_name
- If you only have character based access, use
Then go to: Adaptive Server Enterprise 15.5/Reference Manual: Procedures, nd follow the explorer.
OTHER TIPS
If I wanted to check the permissions for object "whatever_[table|procedure]", I would run the following query:
Example for "whatever" being a table
Displaying result for:
---------------------
select permission = a.name
from master.dbo.spt_values a
, master.dbo.spt_values b
, sysprotects p
, sysobjects o
where a.type = "T"
and a.number = p.action
and b.type = "T"
and b.number = (p.protecttype + 204)
and o.id = p.id
and o.name = 'whatever_table'
permission
----------------------------
References
Select
Insert
Delete
Update
5 Row(s) affected
Example for "whatever" being a stored procedure
Displaying result for:
---------------------
select permission = a.name
from master.dbo.spt_values a
, master.dbo.spt_values b
, sysprotects p
, sysobjects o
where a.type = "T"
and a.number = p.action
and b.type = "T"
and b.number = (p.protecttype + 204)
and o.id = p.id
and o.name = 'whatever_procedure'
permission
----------------------------
Execute
1 Row(s) affected
Adaptive Server Enterprise 15.5 > Reference Manual: Tables > System Tables
sysprotects
sysprotects contains information on permissions that have been granted to, or revoked from, users, groups, and roles.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow