Here is my stored procedure:
If I take the 2nd select statement, and fill in 1 for the variable @EIDs and 01/11/2007 for @start and 01/12/2007 for @finish and place it in a view I get back the rows that I am looking for.
However, if I simply pass in the above two dates I cannot get back any data.
Any suggestions?
Mike55.
Code:
CREATE PROCEDURE dbo.IndividualByMonth
@start datetime,
@finish datetime,
@staff nvarchar
AS
DECLARE @EIDs as int
SELECT @EIDs = EmployeeId
FROM StaffList
WHERE Username = @staff
SELECT TOP 100 PERCENT dbo.Timesheets.Id, dbo.Timesheets.Employee, dbo.Timesheets.[Date],
dbo.Timesheets.Parent, dbo.Timesheets.Child, dbo.Timesheets.Hours, dbo.Timesheets.Comments,
SUM(dbo.Timesheets.[Hour]) AS [hour], SUM(dbo.Timesheets.[Minute]) AS [minute]
FROM dbo.Timesheets INNER JOIN
dbo.StaffList ON dbo.Timesheets.Employee = dbo.StaffList.EmployeeId
WHERE (dbo.Timesheets.Employee = @EIDs) AND (dbo.Timesheets.[Date] BETWEEN CONVERT(DATETIME, @start,103) AND CONVERT(DATETIME,
@finish,103))
GROUP BY dbo.StaffList.Surname, dbo.StaffList.Forename, dbo.Timesheets.Id, dbo.Timesheets.Parent, dbo.Timesheets.Child, dbo.Timesheets.Hours,
dbo.Timesheets.Comments, dbo.Timesheets.OffSite, dbo.Timesheets.Employee, dbo.Timesheets.[Date]
ORDER BY dbo.StaffList.Surname, dbo.StaffList.Forename
GO
If I take the 2nd select statement, and fill in 1 for the variable @EIDs and 01/11/2007 for @start and 01/12/2007 for @finish and place it in a view I get back the rows that I am looking for.
However, if I simply pass in the above two dates I cannot get back any data.
Any suggestions?
Mike55.