DECLARE@SessionNameSysNameSELECT@SessionName=system_healthIFOBJECT_ID(tempdb..#Events)ISNOTNULLBEGINDROPTABLE#EventsENDDECLARE@Target_FileNVarChar(1000),@Target_DirNVarChar(1000),@Target_File_WildCardNVarChar(1000)SELECT@Target_File=CAST(t.target_dataasXML).value(EventFileTarget[1]/File[1]/@name,NVARCHAR(256))FROMsys.dm_xe_session_targetstINNERJOINsys.dm_xe_sessionssONs.address=t.event_session_...