Hello Experts,
I would like to know how do I select a parameter based on the result set from a stored procedure.
My code looks something like this:
CREATE PROCEDURE usp_UserInformation (@ReportRunDate DATE = NULL) AS WITH CTE AS ( SELECT -- some fields FROM Table1 INNER JOIN Table2 ON Table1.ID = Table2.ID WHERE RegisteredDate = DATEADD(MONTH, DATEDIFF(MONTH, -1, @ReportRunDate) - 2, -1) --I'll output the result set after applying all the logic like SELECT User_ID, UserName, DOJ FROM CTE
Now, when the user selects the date on the report, I created another parameter and trying to retrieve records from the "Available Values" using 'Get values from a query'. I would like to show the list of UserIDs from the above query result set and allow the user SELECT based on that.
Here are the screenshots for what I am doing if that helps:
PS: I am not allowed to write in-line SQL and only SPs are allowed. I don't want to create two SPs for the same report.
Known is a DROP, Unknown is an OCEAN.