Invitation to T-SQL Tuesday #17 – APPLY Knowledge
Edit: the party is over, but you can check out our contributors here.
Time to get revved up for T-SQL Tuesday the 17th. As a reminder, here’s Adam’s definition of T-SQL Tuesday:
T-SQL Tuesday is the SQL Server blogosphere’s first recurring, revolving blog party. The idea is simple: Each month a blog will host the party, and about a week before the second Tuesday of the month a theme will be posted. Any blogger that wishes to participate is invited to write a post on the chosen topic. The event is called “T-SQL Tuesday,” but any post that is related to both SQL Server and the theme is fair game. So feel free to post about SSIS, SSRS, Java integration, or whatever other technologies you’re working with in conjunction with SQL Server. Even if your post includes no T-SQL, we still want to see it.
APPLY Knowledge
Recently on Twitter, I heard the claim that “If you don’t understand the APPLY operator, your skills are somewhere around the 50th percentile at best.” While I believe that Adam was giving a warning to self-proclaimed experts (possibly one he might have been interviewing at the time…), I also believe that we could take it as a challenge as a T-SQL blogging community to learn more about APPLY and the ways in which we can use it in our work.
Please share how you use this wonderful feature. Maybe you know how APPLY works inside and out? Perhaps you’ve got a fantastic user defined function (UDF) to share? Or maybe your experience revolves around using Dynamic Management Functions (DMFs) in your never-ending quest for SQL Server performance? Let the community know as it is time to study!
Rules of Engagement
- Your post must be published between 00:00 GMT Tuesday, April 12, 2011, and 00:00 GMT Wednesday, April 13, 2011.
- Your post must begin with the T-SQL Tuesday logo, and it must be linked back to this blog post.
- Make sure that you’re represented in the round-up by leaving a comment below with a link back to your post. Trackbacks should work, but I’m not going to work to find your post if they don’t.
Make it a Success!
- Reference T-SQL Tuesday in your post’s title!
- Tweet about your newly minted post on Twitter using the #tsql2sday hashtag!
- Let Adam Machanic know that you want to host T-SQL Tuesday! You have to have paticipated twice and blog regularly to qualify.

>>“Unless you’re using APPLY, your T-SQL skills are only moderate at best.”
So performing row by row operations with TSQL means I’ve exceeded moderate coding abilities in it?
I’d be very interested to find out who the person that stated that was and exactly what they meant or in what context/situation it was meant to be said in.
Yeah, it was definitely a stark challenge. I honestly can’t remember who said it, but it was Twitter, so it’s even possible that I imagined it from a mash up of tweets together in my TweetDeck.
Adam Machanic said it, and the context was not that you should be using it to perform row by row operations all the time, but that it is a powerful tool in T-SQL and you ought to be aware of it.
Thanks for hosting. Takes a lot of work and much respect
Heh, a friend pointed me to the source and I’ve revised the story a little bit. Nice to know that my memory is completely failing me at this point.
Pingback: @mvelic opens Invitation to T-SQL Tuesday #17 – APPLY Knowledge #tsql2sday | sqlmashup
Matt, fantastic topic!!! I hope I’ll have time to write a post; you’ve caught me right in the middle of my Who is Active documentation series so I’m a bit busy. But obviously this topic is quite near and dear.
Ted, I’m the source of the quote in question, and I stand by it 1000%. In my opinion APPLY opens the door to a huge number of options, both in terms of elegant expression and query performance. I also like to ask about APPLY in interviews, especially when talking to people who have years of experience. It’s a good way to gauge how well they keep up with newer enhancements. But you’re free to disagree with all of this, and I look forward to your post on why APPLY equates to row-by-row processing (and why that’s a bad thing, if I’ve properly caught your implication).
Hey Adam, No, the context was completely off from that. Knowing it is important and agree that knowing APPLY and when going to a level you seem to be with T-SQL, everything should be applied for knowledge. My reference is, just because you don’t use it for something doesn’t mean you are less of a developer with T-SQL. So I think a better way to state it is, “Unless you know APPLY and how it can be used, your T-SQL skills are only moderate at best.”
Pingback: T-SQL Tuesday Reminder – Coming next week « Voice of the DBA
Pingback: T-SQL Tuesday #17: Using Apply to Demystify Deadlocks | SQLSoldier
Well, it’s 24 o’clock somewhere, so here goes: T-SQL #17 – Using Apply to Demystify Deadlocks: http://www.sqlsoldier.com/wp/sqlserver/tsqltuesday17usingapplytodemystifydeadlocks
Pingback: T-SQL Tuesday #017 – APPLY | Luke Hayler - SQL Server Developer
Hey Matt,
Thanks for hosting this month’s T-SQL Tuesday! Here’s my 2c worth:
http://lukehayler.com/2011/04/t-sql-tuesday-017-apply/
Pingback: Rob Farley : SELECT and WHERE, but no FROM clause
Pingback: T-SQL Tuesday#17: It’s all about APPLYcation this time « TroubleshootingSQL
Pingback: SQL SERVER – Query to Recent Query on Server with Exeuction Plan Function to Get SQL « Journey to SQLAuthority
Hi Matt, thanks for hosting this month and coming up with such an interesting topic! Here’s my brief submission.
http://noelmckinney.com/2011/04/t-sql-tuesday-017-apply/
Hi Matt, Thanks for hosting here is my contribution to the fray!
http://www.sqlballs.com/2011/04/t-sql-tuesday-17-apply.html
Hi Matt, this is my contribution
http://leka.com.br/2011/04/12/t-sql-tuesday-17apply/
Pingback: JimMcLeod.Net » T-SQL Tuesday #17–APPLY in Compatibility 80
Pingback: T-SQL Tuesday #17: Applying APPLY | Bob Pusateri - The Outer Join
Thank you for hosting this month Matt.
] posts already!
My post can be found here: http://www.sqlmashup.com/t-sql-tuesday-17-apply-knowledge-tsql2sday
Nice to see so many above average [50%
Pingback: T-SQL Tuesday #17: Using APPLY | Art of the DBA
My entry – with fixed title and url (hopefully nobody saw the previous title or url)
http://jasonbrimhall.info/2011/04/12/t-sql-tuesday-17-%E2%80%93-apply-knowledge/
OK, MATT! Didn’t think I would have this, but hot off the presses for me:
Here is my T-SQL Tuesday #17 contribution, using-apply-to-find-out-which-queries-are-running-on-which-cpu.
Link to the PearlKnows Blog: http://bit.ly/fBDpCF
Here’s my contribution, in case the trackbacks don’t work. Thanks for hosting Matt!
http://awanderingmind.com/2011/04/12/applying-your-sql-knowledge-with-cached-plans-and-xpath-tsql-tuesday-17/
Hi Matthew
Here’s mine, again, in case that the trackbacks fail us.
http://thelonedba.wordpress.com/2011/04/12/t-sql-tuesday-17-apply-knowledge/
Here’s mine. Timely because APPLY is being used for complex extracts on a current DW project.
http://carlosbossy.wordpress.com/2011/04/12/t-sql-apply-essential-tool-for-bi-development/
Thanks for hosting, Matt.
Looks like you’ve got your work cut out for you… there are truckloads of contributions here.
Here’s mine… Enjoy:
http://bradsruminations.blogspot.com/2011/04/t-sql-tuesday-017-it-slices-it-dices-it.html
–Brad Schulz
Great post Brad! Enjoyment received and sorry I missed your previous posts during the research phase. The blog title confused the search engine and myself
Take away, search by “apply operator” next time.
http://www.jasonstrate.com/2011/04/t-sql-tuesday-17-apply-knowledge/
Another post for you… one at the start of the day (where the trackback worked), one at the end.
http://sqlblog.com/blogs/rob_farley/archive/2011/04/13/the-power-of-t-sql-s-apply-operator.aspx
Pingback: T-SQL Tuesday #17–APPLY « DataReader
Pingback: T-SQL Tuesday #17 – APPLYing Yourself to T-SQL « Voice of the DBA
OK, I’m late, a week off, but here’s mine: http://voiceofthedba.wordpress.com/2011/04/14/t-sql-tuesday-17-applying-yourself-to-t-sql/
Pingback: T-SQL Tuesday #18 – My CTE « Voice of the DBA
Pingback: T-SQL Tuesday #17 Roundup - APPLY Knowledge | Matt Velic
Pingback: TSQL Tuesday #026 – Second Chances | Dave's SQL Blog
Pingback: Rob Farley : APPLY – not exactly set-based
Pingback: T-SQL Tuesday #026 – The Wrap Up | Dave's SQL Blog
Pingback: T-SQL Tuesday Topics – Febuary 2012 « Voice of the DBA
Pingback: #Meme15 Meets #T-SQL Tuesday « Chris Shaw's Weblog
Pingback: T-SQL Tuesday Topics – December 2012 Update « Voice of the DBA