This may be a crazy question, but I have been beating it around in my head for days as to how I would possibly do this.
Is there anyway to convert this into a view with a given date range that will change on execution of form?
Maybe there is a way that we can get this into a view, but I am not sure how to get my date range without parameters.
CREATE PROCEDURE dbo.sp_PayTypesandHoursSummaryDateRange
@EnterEmpNo int
,@EnterStartingCheckDate datetime
,@EnterEndingCheckDate datetime
AS
SELECT DISTINCT
pc.emp_no
, pcpa.pay_type
, pt.description
, SUM(pcpa.hours) AS Hours
, SUM(pcpa.cmw_gross) AS Gross
FROM
pay_checks AS pc
INNER JOIN
pay_checks_pay_assoc AS pcpa
ON
pc.pay_checks = pcpa.pay_checks
INNER JOIN
dbo.pay_types AS pt
ON
pcpa.pay_type = pt.pay_type
WHERE
pc.emp_no = --@EnterEmpNo
6111
AND
CONVERT(smalldatetime, pc.check_date)
BETWEEN --@EnterStartingCheckDate
'2000-01-01 00:00:00'
AND --@EnterEndingCheckDate
'2000-06-30 00:00:00'
GROUP BY
pc.emp_no
, pcpa.pay_type
, pt.description
Is there anyway to convert this into a view with a given date range that will change on execution of form?
Maybe there is a way that we can get this into a view, but I am not sure how to get my date range without parameters.
CREATE PROCEDURE dbo.sp_PayTypesandHoursSummaryDateRange
@EnterEmpNo int
,@EnterStartingCheckDate datetime
,@EnterEndingCheckDate datetime
AS
SELECT DISTINCT
pc.emp_no
, pcpa.pay_type
, pt.description
, SUM(pcpa.hours) AS Hours
, SUM(pcpa.cmw_gross) AS Gross
FROM
pay_checks AS pc
INNER JOIN
pay_checks_pay_assoc AS pcpa
ON
pc.pay_checks = pcpa.pay_checks
INNER JOIN
dbo.pay_types AS pt
ON
pcpa.pay_type = pt.pay_type
WHERE
pc.emp_no = --@EnterEmpNo
6111
AND
CONVERT(smalldatetime, pc.check_date)
BETWEEN --@EnterStartingCheckDate
'2000-01-01 00:00:00'
AND --@EnterEndingCheckDate
'2000-06-30 00:00:00'
GROUP BY
pc.emp_no
, pcpa.pay_type
, pt.description