Hi i am still learning sql and I was wandering how can i pass row value in to a function in a cross apply querry.
Assuming that this is my first table
select * from [udf_GetIntervals]('2017-01-01','2017-01-30')
select * from [First_table] cross apply
(select * from #temp)b
You can use
APPLY do perform row-wise actions.
CROSS APPLY behaves similar to an
INNER JOIN, while
OUTER APPLY is rather like a
A Table-Valued-Function returns a table. You must provide an alias and inlcude this resultset into your column list:
SELECT [Project] ,[emp_id] ,[Allocation_start] ,[Allocation_end] ,WeekDates.* From First_table CROSS APPLY dbo.[udf_GetIntervals]([Allocation_start],[Allocation_end]) AS WeekDates