I am trying to apply a join between a table and a scalar-valued function. I have been investigating and I think that it is not possible, but as I do not find any final conclusion saying that I want to be sure.
Do you know if it is possible?
I tried the following statement (do not work):
Select *
from T1
join SVFunction on T1.id=SVFunction.id
And also this one (do not work):
Select *
from T1
outer apply SVFunction (T1.id)
Thank you.
You have to try the following query
Select * ,SVFunction(id)
from T1
Scalar valued function return single value (not table) so you cannot use joins.
If it is a table valued function you can use the following as another way then Using Apply:
Select T1.* ,T2.*
From T1 INNER JOIN (SELECT * FROM SVFunction) AS T2 ON T1.id = T2.id
And Maybe the problem is in the function code. so you can read more about Using Apply in this Technet topic
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With