October 1, 2012 at 12:58 pm
Coffee was a prerequisite in order for me to get this right.
October 2, 2012 at 8:16 am
I just don't get what to do with this APPLY keyword.
The query can be redone using a LEFT OUTER JOIN, which results in the same output and the same plan.
Is APPLY easier to read for you? Are there cases where APPLY is the only way to go?
October 2, 2012 at 8:18 am
Looks like I found an answer. The documentation shows an example where APPLY is used to provide an argument to a table-function that require a parameter. It looks like it can't be done with a JOIN.
October 3, 2012 at 12:14 pm
Thanks for the question.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
October 4, 2012 at 1:29 am
thanks for the question
~ demonfox
___________________________________________________________________
Wondering what I would do next , when I am done with this one :ermm:
October 5, 2012 at 1:34 am
carl.landry (10/2/2012)
I just don't get what to do with this APPLY keyword.The query can be redone using a LEFT OUTER JOIN, which results in the same output and the same plan.
Is APPLY easier to read for you? Are there cases where APPLY is the only way to go?
carl.landry (10/2/2012)
Looks like I found an answer. The documentation shows an example where APPLY is used to provide an argument to a table-function that require a parameter. It looks like it can't be done with a JOIN.
It's not just for calling user-defined table-valued functions. APPLY is also the only way to include a subquery that is correlated to another table in the same FROM clause. Your first post (that the query can be redone using LEFT OUTER JOIN) is not correct; when you do that, it will result in an error. (Okay, technically you are correct; with enough effort you can redo the query with LEFT OUTER JOIN, but that would require a non-trivial effort to rewrite the query, and the result would be harder to read and maintain).
Viewing 6 posts - 16 through 20 (of 20 total)
You must be logged in to reply to this topic. Login to reply