Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2009
    Posts
    66

    Unanswered: Get Current User

    I have a members table with usernames (not SQL accounts). Each of the tables have a "edited username" column which contains the username of the last user who modified the row.

    In my application layer, I authenticate the user and put the username into a session. When I call the stored procedure, is there anyway for it to detect which user is calling the stored procedure WITHOUT passing it in as a parameter?

  2. #2
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    How are they authenticating? Via Windows Authentication, or are they being proxied by an application account? Things you can try are:

    Code:
    select suser_name(), current_user, suser_sname()

  3. #3
    Join Date
    Jun 2009
    Posts
    66
    No, they are using a members table.

  4. #4
    Join Date
    Jun 2009
    Posts
    26
    I don't believe so... if you're application is connecting with it's own credentials then the only way for the stored procedure to know who's calling it is to pass in the username from the session variables.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •