I'm seeing a strange behaviour on one of our servers here. Its a SQL 2008 instance set at a compatibility level of 80 due to some legacy code and I'm seeing queries using new features like APPLY working fine without any issuessee an example below..EXEC sp_dbcmptlevel 'dbname'GOSELECT COUNT(*) AS CntFROM [Import_Staging] stgCROSS APPLY(SELECT Event_category FROM CAT_Mapping mWHERE ',' + stg.event_category + ',' LIKE '%,' + m.HMA_Event_Category + ',%')t...output-----------------------------The current compatibility level is 80.Cnt-----------130(1 row(s) affected)
I checked BOL and this is what it says for APPLY operatorSQL Server 2008 Other Versions SQL Server 2008 R2 SQL Server 2005 6 out of 20 rated this helpful - Rate this topic The APPLY operator allows you to invoke a table-valued function for each row returned by an outer table expression of a query. The table-valued function acts as the right input and the outer table expression acts as the left input. The right input is evaluated for each row from the left input and the rows produced are combined for the final output. The list of columns produced by the APPLY operator is the set of columns in the left input followed by the list of columns returned by the right input. Note To use APPLY, the database compatibility level must be at least 90. I cant understand how the above code is working though!Am I missing something obvious here?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/