?
Solved

Getting name of user's group from Sybase.

Posted on 2013-06-13
8
Medium Priority
?
5,120 Views
Last Modified: 2013-07-09
In Sybase ASE 12.5 we have users in groups.  I need a select statement that will give me the name of the user's group based on the suid.  Can this be done and if so how?
0
Comment
Question by:Amzngmoe
  • 3
  • 2
5 Comments
 
LVL 14

Accepted Solution

by:
Jan Franek earned 2000 total points
ID: 39247232
select u2.name
from sysusers u1, sysusers u2
where u1.suid = suser_id()
and u1.gid = u2.uid
0
 

Author Comment

by:Amzngmoe
ID: 39293814
This gave me a list of the users that are in a particular group.  I actually needed the name of the group.  I noticed that the actual group names are in the same table but have an suid of -2.  I just asked for the name where suid < 0 and that gave the name of the group.  Thank you.
0
 

Author Comment

by:Amzngmoe
ID: 39295726
I've requested that this question be closed as follows:

Accepted answer: 0 points for Amzngmoe's comment #a39293814

for the following reason:

I had to alter the provided solution of the expert who commented to actually get what I needed.
0
 
LVL 14

Expert Comment

by:Jan Franek
ID: 39295727
My query gives you requested result. You have probably mistyped last part. If you use "and u1.gid = u2.gid", you will get the list of users in the group. But with correct "and u1.gid = u2.uid" you will get the group name.
0
 

Author Comment

by:Amzngmoe
ID: 39296377
That is fine. I just wanted a solution. Don't really care about the points.  The commenter can have them.  I copied and pasted the commenter's code so there was no mistyping. I didn't mark that as the solution because others looking at this question need to know that there is another step to actually get the name of the group.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Currently, there is an issue with being able to copy values from an external application to a dropdown list in Project Web Access (PWA).  The standard copy and paste methods don't seem to work properly. Here is a way to accomplish this task to s…
Moore’s Law has proven itself time and time again since it was first introduced. So what’s next? Will Moore’s law continue to remain relevant, or will new technology take over and bring us the next big advancement in computing?
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month13 days, 11 hours left to enroll

755 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