This is a kind of trivial task in my C# homeworld, but I don't yet make it in SQL and would prefer to solve it set-based (without cursors). A resultset should come from a query like this. SELECT SomeId, MyDate, dbo.udfLastHitRecursive(param1, param2, MyDate) as 'Qual...