Solved

Getting name of user's group from Sybase.

Posted on 2013-06-13
8
3,511 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
8 Comments
 
LVL 14

Accepted Solution

by:
Jan_Franek earned 500 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Some of the SEO trends we might expect in 2017.
This article explains the steps required to use the default Photos screensaver to display branding/corporate images
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

809 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