Search code examples
sql-serversql-server-2016ssrs-2016reportmanager

Security within SQL queries


I have created an ssrs report that displays through the report manager and shows rows attached to users. Basically each row is a different user. What I need to do is only show the rows that belong to the user who is running the report.

I know there is a relatively simple way to do this within the stored procedure but that was a long time ago and I cannot find my example. Any ideas?


Solution

  • You can add a field containing User!UserID which will give you the user id running the report.

    You can conditionally show/hide sections & rows by right-clicking on the row/section header on the left side of the design screen and adding a condition for making the row visible when a field from your query matches User!UserID.