I'm using (MVC)
Suppose I'm sending this date range 01/04/2020
to 04/04/2020
from the entry side from my Microsoft SQL Server.
I need to create a selection procedure to select the data from that date range. I created my query to select the details from the following tables but I hardcoded the dates.
But I need to create my procedure to accept any date range from an interface where the user input date range changes always and my query to accept it and return the data back to the MVC program.
Can anyone help me to do this? I'm still learning.
GO
--CREATE PROCEDURE [dbo].[ReservationEnquirySelect_M_Select]'2020-04-01' AND '2020-04-04'
CREATE PROCEDURE [dbo].[ReservationEnquirySelect_M_Select]
AS
BEGIN
SELECT BRD.ReservationDate
,BRH.ReservationNo
,BCP.Name1
,BCP.Name2
,VD.Name
,PT.Name
,BRH.IsCompleted
FROM BanquetReservationDetail BRD
INNER JOIN ReservationHeader BRH ON BRD.ReservationHeaderID = BRH.ReservationHeaderID
INNER JOIN CustomerProfile BCP ON BRH.CutomerProfileID = BCP.CustomerProfileID
INNER JOIN VenueDetails VD ON BRD.VenueID = VD.VenueID
INNER JOIN PackageTypes PT ON BRD.PackageTypeID = PT.PackageTypeID
WHERE ReservationDate BETWEEN '2020-04-01'
AND '2020-04-04'
END
ReservationDate BETWEEN 2020-04-01
and 2020-04-04
. Instead of this, the query should accept a date range from the user.