Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Getting group name from sysusers

Author  Topic 

Ger
Starting Member

11 Posts

Posted - 2002-04-26 : 09:17:18
I'm developing an application in which I would like to get the current user's group, with this query:

SELECT G.name as Fun FROM dbo.sysusers G INNER JOIN dbo.sysusers U ON G.uid = U.gid WHERE (U.name = USER_NAME())

The query runs fine from the enterprise manager. In the application (C++ Builder) I use a TQuery object, I assign the select statement, open the query and do a findfirst. Then when I try to retrieve the field "Fun" I get an exception saying that the field is not found. If I use a method to get the field names, "Fun" shows up, but I can't get the value.
I made sure the username I log in with has select access to sysusers.
Why does this happen? Any ideas? Any other way to get the group name?
Thanks!

   

- Advertisement -