Here’s my scenario:
User inputs date range. Stored Procedure runs, which populates other tables based on dates. User can then click a button to view these tables (another SP which selects from the tables).
Issue:
There are multiple users. Each users needs to be able to have their own tables, so to speak, because date ranges can be different. Right now, user 1 runs SP which populates table for dates A and B. Then user 2 runs SP which populates table for dates C and D. Now user 1 goes and clicks view button, expecting the data for dates A and B but what happens is data for C and D shows up because the last user who ran the SP used dates C and D.
How can I keep the data separate/local for each user?
Thanks.
If you really need to store the query results, then you need to key the result set, either on the user, or generating a scenario ID each time the user runs the report.
The simplest approach is to just run the query as a report and not store the results. Recalculate the output and just dump it each time the user runs the report (i.e. don’t
store ther results).
If you do need to store the results and each user only needs to work with one date range at any given time, then the table can be annotated with a user ID.
If a user can work with more than one scenario, then there needs to be another control table with the scenarios for each user. When the user does a run then a new scenario ID is genereated. You will need a screen to allow users to select the scenario in this case, and probably some means of cleaning out obsolete ones.