SSRS - query to identify USERID not working???

  • I have a query used to get the current user name. It is used to identify users that are associated with specific managers and departments. When the report is run it automatically populates the other parameters with the correct info. It works fine in Visual Studio but doesn’t work when run in Report Manager? Any ideas?

    Select (substring(USER, charindex('\', USER)+1, 25)) AS UserName

    order by UserName

  • Can you expand on what 'doesn't work' means to you? ie it doesn't return anything? it returns a name you don't expect?

    One thing I would check is whether your virtual dir is running Anonymous or Integrated authentication.

    Also note that you may get unexpected results when running reports unattended (eg for scheduled report runs). It's likely that it will use the unattended user account, not the account fo the user who created scheduled report run.

    Steve.

  • 'doesn't work' : The query doesn't execute. Does not return a value for USER.

  • Couple of things to look at... You could run profiler when accessing the report and see what user contex tis being used to pass the query to the server. You could also trim out the functions around USER to see if *any* result is being returned. I'd also check the datasource and report as they're stored on the SSRS instance - looking for what either/both are set to use for the executing user.

    Steve.

  • Also, forgot to ask, why not use User!UserID ? (ie SSRS variable)

    Steve.

Viewing 5 posts - 1 through 5 (of 5 total)

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