eo
MIS
- Apr 3, 2003
- 809
Hi
CR10. I am fairly new to SP's.
I have a table that shows the Start_Date_Range, End_Date_Range, Week_Number and Year of all weeks, from 1985 till 2015.
I have a report which contains a Date, I need to allocate the Week_Number in which that Date exists to that Date.
I though a good excuse/ reason/ solution to use a Stored Procedure to solve this.
My coding looks like this:
My idea is to pass the Date from CR to the SP and have it return the applicable Week_Number and Year.
So I add the Stored Procedure to the report (in the same way I would a table or a view). The report then immediately requires me to select a @ReportDate (the option is to select a Date or set value to null - I have tried both)...
Then the report automatically brings up the linking expert. I assume that there will be no link, as this is exactly the reason for the SP...it needs to allocate the Week_Number to the Date.
The report returns no results. What will be the link between the report data and the SP. Is it done in the Select Expert. I have tried Date = {?@ReportDate}
Before I delve any further, do I seem to be on the correct track???
EO
Hertfordshire, England
CR10. I am fairly new to SP's.
I have a table that shows the Start_Date_Range, End_Date_Range, Week_Number and Year of all weeks, from 1985 till 2015.
I have a report which contains a Date, I need to allocate the Week_Number in which that Date exists to that Date.
I though a good excuse/ reason/ solution to use a Stored Procedure to solve this.
My coding looks like this:
Code:
Create Procedure sp_Get_week_no_1
@ReportDate DateTime
AS
Select WK_Week_Num,
WK_Year
From MAGIC.PanAshLive.dbo.Etienne_Weeks
Where @ReportDate >= Wk_Start_Date and
@ReportDate <= Wk_End_Date
GO
My idea is to pass the Date from CR to the SP and have it return the applicable Week_Number and Year.
So I add the Stored Procedure to the report (in the same way I would a table or a view). The report then immediately requires me to select a @ReportDate (the option is to select a Date or set value to null - I have tried both)...
Then the report automatically brings up the linking expert. I assume that there will be no link, as this is exactly the reason for the SP...it needs to allocate the Week_Number to the Date.
The report returns no results. What will be the link between the report data and the SP. Is it done in the Select Expert. I have tried Date = {?@ReportDate}
Before I delve any further, do I seem to be on the correct track???
EO
Hertfordshire, England