Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

What is Cross Apply ? Expand / Collapse
Posted Thursday, July 25, 2013 10:29 AM


Group: General Forum Members
Last Login: Monday, July 6, 2015 1:28 AM
Points: 188, Visits: 516
Hi I'm newbie to SQL ...

Please explain in simpler words. What is Cross Apply ?

Examples pls...
Post #1477619
Posted Thursday, July 25, 2013 1:47 PM



Group: General Forum Members
Last Login: Today @ 2:09 AM
Points: 15,501, Visits: 13,163
Simply put: you join a table with a table valued function.
This article explains the concept and has some examples:
SQL Server APPLY Basics

How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at SQLKover.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1477713
Posted Thursday, July 25, 2013 7:45 PM

Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Wednesday, February 24, 2016 6:28 AM
Points: 3,977, Visits: 6,431
Here are some additional links:

Understanding and Using APPLY (Part 1) by Paul White
Understanding and Using APPLY (Part 2) by Paul White
The Cascading (CROSS) APPLY by Chris Morris

And don't miss the first link in my signature for a neat way to UNPIVOT using CROSS APPLY.

My mantra: No loops! No CURSORs! No RBAR! Hoo-uh!

My thought question: Have you ever been told that your query runs too fast?

My advice:
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

Need to UNPIVOT? Why not CROSS APPLY VALUES instead?
Since random numbers are too important to be left to chance, let's generate some!
Learn to understand recursive CTEs by example.
Splitting strings based on patterns can be fast!
My temporal SQL musings: Calendar Tables, an Easter SQL, Time Slots and Self-maintaining, Contiguous Effective Dates in Temporal Tables
Post #1477825
Posted Thursday, July 25, 2013 7:52 PM



Group: General Forum Members
Last Login: Monday, November 21, 2016 11:03 AM
Points: 20,009, Visits: 18,255
You can also check out this series of blog posts

Jason AKA CirqueDeSQLeil
I have given a name to my pain...


Posting Performance Based Questions - Gail Shaw
Post #1477829
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse