試してみてください:
With DependencedIncidents AS ( SELECT INC.[RecTime],INC.[SQL] AS [str] FROM ( SELECT A.[RecTime] As [RecTime],X.[SQL] As [SQL] FROM [EventView] AS A CROSS JOIN [Incident] AS X WHERE patindex('%' + A.[Col] + '%', X.[SQL]) > 0 ) AS INC ), lalala AS ( SELECT INC.[RecTime],INC.[SQL] AS [str] FROM ( SELECT A.[RecTime] As [RecTime],X.[SQL] As [SQL] FROM [EventView] AS A CROSS JOIN [Incident] AS X WHERE patindex('%' + A.[Col] + '%', X.[SQL]) > 0 ) AS INC )
プレ>はい、共通テーブル式定義内で共通テーブル式を参照できます。再帰的にも。これは、いくつかの非常に巧妙なトリック> .