Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Cross Apply

Author  Topic 

SQLLinq
Starting Member

2 Posts

Posted - 2012-01-17 : 11:01:42
How do I use a cross apply to expand a table, example if you have any!
Thanks

SQLLinq

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-01-17 : 11:13:48
Not quite sure what you meant by "expand a table", but would this help? http://weblogs.sqlteam.com/jeffs/archive/2007/10/18/sql-server-cross-apply.aspx
Go to Top of Page

SQLLinq
Starting Member

2 Posts

Posted - 2012-01-17 : 11:22:54
Need More -- Please help - Can you give me a low down on Cross Apply

SQLLinq
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-01-17 : 11:35:05
This article on simple-talk is pretty good:
http://www.simple-talk.com/sql/t-sql-programming/sql-server-apply-basics/

Itzik Ben-Gan's book ( http://www.amazon.com/Inside-Microsoft%C2%AE-SQL-Server%C2%AE-2008/dp/0735626030 ) has a section on APPLY, which is very good. The following quote from that books sort of summarizes the concept for me:

"The APPLY table operator applies the right-hand table expression to every row of the left-hand table expression. Unlike a join, where the order in which each of the table expressions is evaluated is unimportant, APPLY must logically evaluate the left table expression first. This logical evaluation order of the inputs allows the right table expression to be correlated with the left one."

I don't have much more to add, may be someone else on the forum may be able to suggest something.
Go to Top of Page
   

- Advertisement -