> : > I am using VB 3.0 to connect to SQL Server 6.0 via ODBC API. Is
> : > a way to obtain the SQL Server _group_ that the currently logged in
> : > user belongs to? My application will implement certain functions if
> : > the current user belongs to a certain group.
> : >
> : select 'group' = name
> : from sysusers u1,
> : sysusers u2
> : where u1.uid = user_id()
> : and u1.gid = u2.gid
> : and u2.suid < 0
> Nice, but curious, why the last line?
Because users and groups are held in the same table, differentiated only
by groups having suids < 0...
If you leave out the last line you get the group row and the user row.
There is actually a slight mistake in the above code - it should read:
select 'group' = u2.name
I expect one of the reasons why it's taking so long to implement
multiple-group membership is the design of this table, another Sybase
The SQL Workshop
Milton Keynes, UK