December 21, 2009 at 11:45 pm
where do we use cross apply ?
please expline about cross apply with simple example
December 22, 2009 at 12:16 am
Did you consider BOL (BokksOnLine, the SQL Server help file) as a source?
Please see chapter "cross apply" for details. There is an example as well.
Even though the example shows the usage of a function, a query can also be used instead.
December 22, 2009 at 12:16 pm
A CROSS APPLY will be applied against each row in the table/view it is joined to. For example this query returns a row for each record in sys.sysprocesses. It includes the result of the sys.dm_exec_sql_text DMF for each of those rows, passing in the sql_handle from SSP for the parameter:
SELECT SSP.*, DEST.text
FROM sys.sysprocesses SSP CROSS APPLY sys.dm_exec_sql_text(SSP.sql_handle) DEST
Help?
- Tim Ford, SQL Server MVPhttp://www.sqlcruise.comhttp://www.thesqlagentman.com http://www.linkedin.com/in/timothyford
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply