SQLug.se - Itzik Ben-Gan - Creative Uses of the APPLY Operator, session 1
Why Stack Overflow recommends it
Stack Overflow users link it when explaining how CROSS APPLY works in SQL Server and why it is useful for subqueries, string cleanup and optimizer-friendly queries.
Recommended by 3 people across 3 different months, 2014 to 2017.
What it is
A recording of Itzik Ben-Gan's session at the Swedish SQL Server User Group in Stockholm on creative uses of the APPLY operator (CROSS APPLY and OUTER APPLY) in T-SQL. It is the first of a multi-part talk, running about 35 minutes.
What people said
Strong rec Jason A. Long · 2017-09 · Stack Overflow · on “SQL Server query optimization for a example update query”
@AskMe - Are you asking what the CROSS APPLY is doing or how the CROSS APPLY operators works in general? If it's the former, **JM_7** is exactly correct. It's stripping out and spaces & semi-colons from the string. If the rest of your data has other non int characters, it should be expanded to strip those as well. If it's later, that's a far too large a topic for a few hundred characters... Here's are a couple of really good videos from Itzik Ben-Gan. There really are worth the time it takes to watch them [this video] & [LINK]
Recommends bobthedeveloper · 2014-12 · Stack Overflow · on “Remove Sub Queries from Select Statement?”
I don't know how much it helps in your query tho, learned about it some days ago. You should check this talk out [this video]
Recommends Paul Maxwell · 2015-03 · Stack Overflow · on “Double count on two tables”
it is part of the FROM clause, which is performed at the beginning of the query (unlike the select clause which is performed toward the end of a query). In SQL Server this has benefits for the optimizer. As an added bonus the data referenced this way can be referenced by its alias throughout the query. (Perhaps not such a bonus for this query, but it can be). If really interested try [this video] and [LINK]
Cites TheGameiswar · 2016-07 · Stack Overflow · on “SQL Index performance ,, which is better?”
This index CREATE INDEX tbl_idx ON tbl (a, b); Will be useful for these queries where a= and b = where a= and b> where a like 'someval%' and b= but not useful for these queries: where b= where a> and b= where a like '%someval%' and b= where isnull(a,'')= and b= In summary, in a multicolumn index, if SQL Server was able to do a seek on first key column then the index would be useful.. Coming to your question, the first query would benefit from index you created whereas second query may tend to do a scan on this index.. There are many factors which dictate whether seek is good or bad.In some cases SQL Server may tend to not use the index available like bookmark lookup cost exceeds limit.. Refe