CurrentUser Not Working

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
 
J

John Thomas

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top