Ssrs using wiondows authenication

When executing an ssrs 2008 report, I would like to ask the following question(s) in regards to obtaining the userid value when utilizing windows authenication:

  1. Does the sql always need to be a stored procedure? Can it be inline sql, a view, and/or a function? Can you show me the code and/or point me to url(s) links on how to obtain the userid?

  2. The report I want to generate does not use login/userid. It uses a unique identifier in the database. Thus to make the user id access work correctly, I am thinking I would need to create a table that would show the following for each row in the table:

a. domain name/login id, and

b. the corresponding userid that is in the database

,correct? If so, would this code need to be part of a stored procedure and/or can it be inline sql?

SSRS allows you to use a stored procedure or an adhoc query - see screenshot below of a sample dataset.

Regarding userid vs domain login, what you described seems appropriate. You can get the user id of the user who is running the report via the built in field UserId.

1 Like