I tried to write ms sql code that gives you working time in minutes. It takes two entries as a date. But it always returns 0. What did I do wrong?
Create FUNCTION getMinutesWork
(
@inp1 date,
@inp2 date
)
RETURNS int
As
Begin
DECLARE @outp int = DATEDIFF(mi,@inp1,@inp2)
RETURN(@outp)
End
And I tried to run it using this
SELECT dbo.getMinutesWork('2004-10-18 07:53:31','2004-10-18 10:13:35') AS WorkTime
It returns 0. I am so new to sql. You can help?
source
share