Sample Header Ad - 728x90

CROSS APPLY on Scalar function

8 votes
2 answers
19153 views
I have this: SELECT A ,B ,dbo.Func(C) ,dbo.Func(D) ,dbo.Func(E) ,F FROM abcdef WHERE 0 = dbo.Func(C) + dbo.Func(D) I have read that this is not good practice because the function is called million of times and it has a bad impact on performance. I tried to rewrite it with CROSS APPLY: SELECT * FROM abcdef CROSS APPLY dbo.Func(D) as FD but it returns this error: Invalid object name 'dbo.Func' Can I use CROSS APPLY only on TABLE VALUED functions ? And is CROSS APPLY suitable for scalar functions (converted to table valued function) anyway ? Because on my small performance test CROSS APPLY is a bit slower.
Asked by Muflix (1099 rep)
Apr 8, 2015, 08:12 PM
Last activity: May 24, 2021, 08:37 PM