Select by User Login

  • I would like to create a View or Stored Procedure that can include the login id of the user selecting/running the stored procedure/view.

    I have a table with Windows User IDs and the jobs they are allowed to view.

    It would be fantastic to have a stored procedure that used the login of the person running the query in the 'Where' statement.

    I have built a stored procedure and I can enter the user id and it works. But I'd rather find an MSSQL variable that tells me.

    Thank you,

  • You can try the user_name() or suser_name() functions.

  • Thank you,

    It took some playing but I got it working.

    Now the real work begins.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply