Hi,
I've got a situation where I need to execute a stored procedure based on the Location and report ID return values.
Here are my sp code and select query result.
Declare @TodayDate datetime, @NextRunDate datetime;
Set @TodayDate = convert(date, getdate())
Select ReportID, Type, Location, NextRunDate, SpToExec Into #ReportSchedule From tblSchedule Where NextRunDate = @TodayDate
Select * From #ReportSchedule (This gives me the details of the two report stored procedures I need to run)

Next, I want to execute the stored procedures using the value returned in my SQL code. Ideally, I would like to do some sort of comparison before I execute the store procedure. This is to pass the sp parameter dynamically, instead of hard coded value.
As per above example, I want to execute following two sp that is for this report id and location.
Exec spCR1005HL7NEW0717 @Location = N'Bracknell'
Exec spCR1006HL7NEW0717 @Location = N'Bracknell'
thank you in advance...!
Mustansar