Solved

How can I show grants in Sybase IQ? (for one or all objects)

Posted on 2011-09-21
1
2,507 Views
Last Modified: 2012-05-12
I guess I can do it by joining SYS tables, but I was expecting to find something like sp_iqhelpprotect.

Is there Sybase supplied a way to show grants for various types of objects (or for individual objects)?

If not, can anyone point me to a code snippet to do this?

Thanks in advance
Ben
0
Comment
Question by:BenSlade
1 Comment
 
LVL 1

Accepted Solution

by:
BenSlade earned 0 total points
ID: 36602202
I found this in the IQ svrlog when I showed permissions in Sybase Central.   So I guess I can close this question.
-- Show table/view grants for table_owner_name.mytablename
--
SELECT E.user_name, E.user_group, P.selectauth, P.insertauth, P.deleteauth, P.updateauth, P.alterauth,
  P.referenceauth, SUM( DISTINCT C.privilege_type )
FROM SYS.SYSTABLEPERM P
        JOIN SYS.SYSUSERPERMS E ON E.user_id = P.grantee
        JOIN SYS.SYSTABLE T ON T.table_id = P.stable_id
        JOIN SYS.SYSUSERPERMS U ON U.user_id = T.creator 
        LEFT OUTER JOIN SYS.SYSCOLPERM C ON C.table_id = T.table_id AND C.grantee = P.grantee
WHERE U.user_name = 'table_owner_name' AND T.table_name = 'mytablename'
GROUP BY E.user_name, E.user_group, P.selectauth,
        P.insertauth, P.deleteauth, P.updateauth, P.alterauth, P.referenceauth
ORDER BY E.user_name

-- Show users who can execute proc_owner_name.myprocname
--
SELECT E.user_name, E.user_group
FROM SYS.SYSPROCPERM R
        JOIN SYS.SYSUSERPERMS E ON E.user_id = R.grantee
        JOIN SYS.SYSPROCEDURE P ON P.proc_id = R.proc_id
        JOIN SYS.SYSUSERPERMS U ON U.user_id = P.creator
WHERE U.user_name = 'proc_owner_name' AND P.proc_name = 'myprocname'
ORDER BY E.user_name

Open in new window

0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
What is Backup? Backup software creates one or more copies of the data on your digital devices in case your original data is lost or damaged. Different backup solutions protect different kinds of data and different combinations of devices. For e…
This video discusses moving either the default database or any database to a new volume.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now