You still have options if you are either using Windows Authentication with a dedicated, impersonated account or a SQL login for the data source from SSRS to SQL.You can pass the username for the user logged on to SSRS as a parameter to the report procedure.- Create an internal parameter on each report with a default value of User!UserID.This will grab the fully qualified user name that is authenticated against SSRS, e.g. DOMAIN\USERNAME.
- Use that report parameter and pass it as a parameter to the stored procedure.
- Use the sproc parameter to find the appropriate store value and filter the data for the query.
You would need a table that holds the StoreID and UserName combinations (I would design this out MUCH more, but this is a simple, non-optimized example. you can normalize the schema as you desire). Optimizing the example ChrisBui2008 gave:SELECT Daily, WTD, MTD, YTDFROM StoreSales ssINNER JOIN StoreUsers su ON ss.StoreID = su.StoreIDWHERE su.UserName = @UserName
If you ARE passing Windows Authentication for your SSRS data source (not a dedicated account but whomever is logged on to SSRS) then go with SYSTEM_USER, but write the query this way:SELECT Daily, WTD, MTD, YTDFROM StoreSales ssINNER JOIN StoreUsers su ON ss.StoreID = su.StoreIDWHERE su.UserName = SYSTEM_USER
If you provide more detail on your system setup we can give you a better suggestion.Kevin