I have a user defined function like this:
CREATE FUNCTION getMinutesWork
(
@startT datetime,
@endT datetime
)
RETURNS int
As
Begin
bla bla
bla bla
RETURN @totalMinute
End
It calculates total minutes between two dates. I want to use it with a table like this:
WorkerID |LastName| FirstName | StartDate | EndDate
1 | JOHN | SNOW |1979-12-26 02:47:00 | 1999-02-16 12:44:00
2 | ... | ... | .... . | .....
StartDate and EndDate are inputs. But i couldnt figure out how ill turn my function table valued one
SELECT t.WorkerID, t.LastName, t.Firstname, t.StartDate, t.EndDate, MinutesWork = getMinutesWork(t.StartDate, t.EndDate) FROM YourTable AS t