Hello, I am working with a stored procedure to return two recordsets to the
application. The second recordset depends on the first recordset for a
returned value to be used as an input parameter. I'm having trouble passing
the parameter between the two recordsets without having to go in and out of
the application during the process.
particular country. Only one record will be returned in all cases. The
value of the r1.summary will be displayed in the application. The value of
the r1.mewr_id must be passed along to be used as a parameter in the second
portion of the stored procedure (see STATEMENT 2).
STATEMENT 1 SELECT FROM monthly_ew_reports r1 INNER JOIN countries c1 ON r1.country_id = WHERE (r1.cvg_start = In the second recordset, the mewr_id value of the one record returned from STATEMENT 2 FROM monthly_ew_reports r1 INNER JOIN countries c1 ON r1.country_id = WHERE r1.country_id = '<PARAMETER>' How can I write my stored procedure so that in the end, the application Please help if you can... ___________
---------------------------------------------------------------------------
-------------
CREATE PROCEDURE [dbo].[get_country_home_2]
as
r1.country_id,
r1.mewr_id,
r1.summary
c1.cy_id
(SELECT MAX(r2.cvg_start)
FROM monthly_ew_reports AS r2
---------------------------------------------------------------------------
--------------
the first statement should be used as the parameter to pass into the this
statement (STATEMENT 2):
---------------------------------------------------------------------------
--------------
SELECT
r1.mewr_id,
datename(m, r1.cvg_start) as cvg_start_month,
datename(d, r1.cvg_start) as cvg_start_day,
datename(m, r1.cvg_end) as cvg_end_month,
datename(d, r1.cvg_end) as cvg_end_day
c1.cy_id
---------------------------------------------------------------------------
--------------
receives two recordsets as described above.