When I run the the line in red in Query Analyser it runs great and displays the proper date. but when I put it in my Function it error out saying there is an error near 1
CREATE FUNCTION dbo.Get_AdjHrs (@EmpID int, @Date datetime )
RETURNS numeric (5,2) AS
BEGIN
Declare @AdjT numeric(5,2)
Select @AdjT = STR(SUM(Hrs_Time / 60), 6, 2)
From Hr_Adjustments
Where
Person_id = @EmpID and Hr_Date >dateadd("MM", -1, dbo.firstofmonth(getdate()))
RETURN @AdjT
END
What I am trying to do is get a report starting from the 1st of the previous month.
but I cannot figure out what I am doing wrong
Any help would be greatly appreciated
Thanks in advance.
CREATE FUNCTION dbo.Get_AdjHrs (@EmpID int, @Date datetime )
RETURNS numeric (5,2) AS
BEGIN
Declare @AdjT numeric(5,2)
Select @AdjT = STR(SUM(Hrs_Time / 60), 6, 2)
From Hr_Adjustments
Where
Person_id = @EmpID and Hr_Date >dateadd("MM", -1, dbo.firstofmonth(getdate()))
RETURN @AdjT
END
What I am trying to do is get a report starting from the 1st of the previous month.
but I cannot figure out what I am doing wrong
Any help would be greatly appreciated
Thanks in advance.