Re: Cross apply doesn't require a UDF
- From: Plamen Ratchev <Plamen@xxxxxxxxxxxxx>
- Date: Fri, 26 Jun 2009 12:42:21 -0400
While CROSS APPLY is really not document well (hope they update it soon), there are plenty of examples on the web that demonstrate use of the APPLY operator with table expressions. A quick search on CROSS APPLY shows a few on the first page that demonstrate that, here is one:
http://weblogs.sqlteam.com/jeffs/archive/2007/10/18/sql-server-cross-apply.aspx
Yes, indeed it is a powerful operator, see this example:
CREATE TABLE Foo (
keycol INT PRIMARY KEY,
x INT,
y INT);
INSERT INTO Foo VALUES(1, 10, 5), (2, 11, 4), (3, 8, 3);
SELECT keycol, x, y, z
FROM Foo
CROSS APPLY (SELECT x + y AS z) AS C;
/*
keycol x y z
----------- ----------- ----------- -----------
1 10 5 15
2 11 4 15
3 8 3 11
*/
--
Plamen Ratchev
http://www.SQLStudio.com
.
- Follow-Ups:
- Re: Cross apply doesn't require a UDF
- From: Eric Isaacs
- Re: Cross apply doesn't require a UDF
- References:
- Cross apply doesn't require a UDF
- From: DWalker07
- Cross apply doesn't require a UDF
- Prev by Date: Re: Iterate Records
- Next by Date: Can I search blob without code?
- Previous by thread: Cross apply doesn't require a UDF
- Next by thread: Re: Cross apply doesn't require a UDF
- Index(es):
Relevant Pages
|