I have a table-valued function built as a SQLCLR function calling a calculation on a remote Web Service. I was wondering if the CROSS APPLY function will call the function in parallel or in a sequential manner?
I am not sure the web service supporting the calculation is really thread-safe.
Cross-apply query:
WITH listCTE AS
(
SELECT 'definition1' AS def UNION ALL
SELECT 'definition2' AS def UNION ALL
SELECT 'definition3' AS def
)
SELECT calc.*
FROM listCTE a
CROSS APPLY dbo.f_webservice_calculate (a.def,'2017-06-30') calc
SQLCLR TVF function definition.
[SqlFunction(
Name = "f_webservice_calculate",
DataAccess = DataAccessKind.Read,
FillRowMethodName = "fillRowMethod",
SystemDataAccess = SystemDataAccessKind.Read
)]
public static IEnumerable f_webservice_calculate(string def, DateTime date)
{
...calling web service using HttpWebRequest
}