There are ways to simulate cross apply. You have to build a query that does what the function does, but which doesn't have input parameters. Then you include the "parameters" as columns in its output, and join to it on those. That's often more efficient than Cross Apply, but it won't do dynamic columns, which is what you're looking for. Actually, I'm not sure how to get Cross Apply to do dynamic columns, so maybe I'm misunderstanding what you need.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon