I tried to write a ms sql code that gives you workers work time in minutes. It takes two input as date. But it always return 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 with this
SELECT dbo.getMinutesWork('2004-10-18 07:53:31','2004-10-18 10:13:35') AS WorkTime
It returns 0. Im so newbie on sql. Can you help?