CurrentUser Not Working

  • Thread starter Thread starter Dan M
  • Start date Start date
D

Dan M

Access XP project file with SQL Server 2K back end. Using
NT authentication, so existing users can access the db
without a separate login.

Using T-SQL security functions, attempting to determine
current user. I've used Current_User, SUser_SName(),
System_User, User_ID(), User_Name() and they all return
either dbo or sa. All users have user objects and
matching logins.

I simply need to return their actual user name instead of
dbo and sa. Any ideas.

I'm trying to pull their user name in a stored procedure's
output parameter.

CREATE PROCEDURE sp_GetCurrentUser @theUser nvarchar(50) =
Null OUTPUT

AS

SELECT @theUser = User_Name() --(I've used all the above
mentioned functions here.)
SELECT @theUser
 
Are you using ADO to pull the output parameter of the
stored procedure? If so, be careful about the connection
you are using for the command object. It is best if you
use a connection object with a trusted connection, and
your command object's activeconnection property is set to
your connection object.
 
Back
Top