daily pastebin goal
64%
SHARE
TWEET

TempDB Query Top 3 (SQL)

bytecoded Mar 23rd, 2019 (edited) 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (@P1 numeric(10),@P2 numeric(10),@P3 numeric(10),@P4 numeric(10),@P5 numeric(10),@P6 numeric(10),@P7 numeric(10),@P8 numeric(10),@P9 numeric(10),@P10 numeric(10),@P11 nvarchar(4000),@P12 numeric(10),@P13 varbinary(16),@P14 numeric(10),@P15 numeric(10),@P16 numeric(10),@P17 numeric(10),@P18 numeric(10),@P19 datetime2(3),@P20 datetime2(3),@P21 numeric(10),@P22 numeric(10),@P23 numeric(10),@P24 nvarchar(4000),@P25 numeric(10),@P26 varbinary(16),@P27 numeric(10),@P28 numeric(10),@P29 numeric(10),@P30 numeric(10),@P31 numeric(10),@P32 numeric(10),@P33 numeric(10),@P34 numeric(10),@P35 nvarchar(4000),@P36 numeric(10),@P37 varbinary(16),@P38 numeric(10),@P39 numeric(10),@P40 numeric(10),@P41 numeric(10),@P42 numeric(10),@P43 numeric(10),@P44 numeric(10),@P45 numeric(10),@P46 numeric(10),@P47 numeric(10),@P48 nvarchar(4000),@P49 numeric(10),@P50 varbinary(16),@P51 numeric(10),@P52 numeric(10),@P53 numeric(10),@P54 numeric(10),@P55 numeric(10),@P56 numeric(10),@P57 numeric(10),@P58 nvarchar(4000),@P59 numeric(10),@P60 varbinary(16),@P61 numeric(10),@P62 numeric(10),@P63 numeric(10),@P64 numeric(10),@P65 numeric(10),@P66 numeric(10),@P67 numeric(10),@P68 numeric(10),@P69 nvarchar(4000),@P70 numeric(10),@P71 varbinary(16),@P72 numeric(10),@P73 numeric(10),@P74 numeric(10),@P75 numeric(10),@P76 numeric(10),@P77 numeric(10),@P78 numeric(10),@P79 numeric(10),@P80 numeric(10),@P81 nvarchar(4000),@P82 numeric(10),@P83 varbinary(16),@P84 numeric(10),@P85 numeric(10),@P86 numeric(10),@P87 numeric(10),@P88 numeric(10),@P89 datetime2(3),@P90 datetime2(3),@P91 numeric(10),@P92 numeric(10),@P93 numeric(10),@P94 nvarchar(4000),@P95 numeric(10),@P96 varbinary(16),@P97 numeric(10),@P98 numeric(10),@P99 numeric(10),@P100 numeric(10),@P101 numeric(10),@P102 datetime2(3),@P103 datetime2(3),@P104 numeric(10),@P105 numeric(10),@P106 numeric(10),@P107 nvarchar(4000),@P108 numeric(10),@P109 varbinary(16),@P110 numeric(10),@P111 numeric(10),@P112 numeric(10),@P113 numeric(10),@P114 numeric(10),@P115 datetime2(3),@P116 datetime2(3),@P117 numeric(10))INSERT INTO #tt183 WITH(TABLOCK) (_Q_000_F_000_TYPE, _Q_000_F_000_RTRef, _Q_000_F_000_RRRef, _Q_000_F_001RRef, _Q_000_F_002, _Q_000_F_003RRef, _Q_000_F_004, _Q_000_F_005, _Q_000_F_006, _Q_000_F_007) SELECT
  2. T1.Fld11293_TYPE,
  3. T1.Fld11293_RTRef,
  4. T1.Fld11293_RRRef,
  5. T1.Fld11295RRef,
  6. (T1.Fld11302Turnover_ - T1.Fld11303Turnover_),
  7. T65.IDRRef,
  8. CASE WHEN CASE WHEN T1.Fld11290_TYPE = 0x08 AND T1.Fld11290_RTRef = 0x00000058 THEN T74._Fld12837 ELSE CAST(NULL AS BINARY(1)) END = 0x01 THEN (T1.Fld11302Turnover_ - T1.Fld11303Turnover_) ELSE 0.0 END,
  9. CASE WHEN (NOT ((CASE WHEN T1.Fld11290_TYPE = 0x08 AND T1.Fld11290_RTRef = 0x00000058 THEN T74._Fld12837 ELSE CAST(NULL AS BINARY(1)) END) = 0x01)) THEN (T1.Fld11302Turnover_ - T1.Fld11303Turnover_) ELSE 0.0 END,
  10. CAST(0.0 AS NUMERIC(21, 2)),
  11. CAST(NULL AS NUMERIC(21, 2))
  12. FROM (SELECT
  13. T2._Fld11295RRef AS Fld11295RRef,
  14. T2._Fld11290_TYPE AS Fld11290_TYPE,
  15. T2._Fld11290_RTRef AS Fld11290_RTRef,
  16. T2._Fld11290_RRRef AS Fld11290_RRRef,
  17. T2._Fld11293_TYPE AS Fld11293_TYPE,
  18. T2._Fld11293_RTRef AS Fld11293_RTRef,
  19. T2._Fld11293_RRRef AS Fld11293_RRRef,
  20. CAST(SUM(T2._Fld11303) AS NUMERIC(33, 8)) AS Fld11303Turnover_,
  21. CAST(SUM(T2._Fld11302) AS NUMERIC(33, 8)) AS Fld11302Turnover_
  22. FROM dbo._AccumRgTn11305 T2
  23. WHERE (((T2._Fld595 = @P1)) AND (EXISTS(SELECT
  24. 1
  25. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  26. LEFT OUTER JOIN dbo._Document233 T3
  27. ON (T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000E9 AND T2._Fld11293_RRRef = T3._IDRRef) AND (T3._Fld595 = @P2)
  28. LEFT OUTER JOIN dbo._Document212 T4
  29. ON (T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000D4 AND T2._Fld11293_RRRef = T4._IDRRef) AND (T4._Fld595 = @P3)
  30. LEFT OUTER JOIN dbo._Document234 T5
  31. ON (T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000EA AND T2._Fld11293_RRRef = T5._IDRRef) AND (T5._Fld595 = @P4)
  32. LEFT OUTER JOIN dbo._Document263 T6
  33. ON (T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x00000107 AND T2._Fld11293_RRRef = T6._IDRRef) AND (T6._Fld595 = @P5)
  34. LEFT OUTER JOIN dbo._Document216 T7
  35. ON (T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000D8 AND T2._Fld11293_RRRef = T7._IDRRef) AND (T7._Fld595 = @P6)
  36. LEFT OUTER JOIN dbo._Document215 T8
  37. ON (T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000D7 AND T2._Fld11293_RRRef = T8._IDRRef) AND (T8._Fld595 = @P7)
  38. LEFT OUTER JOIN dbo._Document213 T9
  39. ON (T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000D5 AND T2._Fld11293_RRRef = T9._IDRRef) AND (T9._Fld595 = @P8)
  40. LEFT OUTER JOIN dbo._Document199 T10
  41. ON (T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000C7 AND T2._Fld11293_RRRef = T10._IDRRef) AND (T10._Fld595 = @P9)
  42. LEFT OUTER JOIN dbo._Reference42 T11
  43. ON ((CASE WHEN T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000E9 THEN T3._Fld4625RRef WHEN T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000D4 THEN T4._Fld3516RRef WHEN T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000EA THEN T5._Fld4774RRef WHEN T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x00000107 THEN T6._Fld6287RRef WHEN T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000D8 THEN T7._Fld3845RRef WHEN T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000D7 THEN T8._Fld3734RRef WHEN T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000D5 THEN T9._Fld3600RRef WHEN T2._Fld11293_TYPE = 0x08 AND T2._Fld11293_RTRef = 0x000000C7 THEN T10._Fld2840RRef ELSE CAST(NULL AS BINARY(16)) END = T11._IDRRef)) AND (T11._Fld595 = @P10)
  44. WHERE EXISTS(SELECT
  45. 0x01 AS Q_001_F_000_
  46. FROM dbo._Reference98 T12
  47. INNER JOIN dbo._Reference21 T13
  48. ON (((T12._Fld1685 = @P11) AND EXISTS(SELECT
  49. 0x01 AS Q_004_F_000_
  50. FROM dbo._InfoRg11709 T14
  51. WHERE ((T14._Fld595 = @P12)) AND ((T14._Fld12065RRef = T12._IDRRef) AND (T14._Fld12066RRef = T13._IDRRef)))) AND T13._IDRRef IN
  52. (SELECT
  53. T15._Reference21_IDRRef AS Q_005_F_000RRef
  54. FROM dbo._Reference21_VT782 T15
  55. INNER JOIN dbo._InfoRg9937 T16
  56. ON ((T16._Fld9939_TYPE = 0x08 AND T16._Fld9939_RTRef = 0x00000095 AND T16._Fld9939_RRRef = @P13) AND (T16._Fld9938_TYPE = T15._Fld784_TYPE AND T16._Fld9938_RTRef = T15._Fld784_RTRef AND T16._Fld9938_RRRef = T15._Fld784_RRRef))
  57. WHERE ((T15._Fld595 = @P14)) AND (T16._Fld595 = @P15)))
  58. WHERE ((T13._Fld595 = @P16)) AND ((CASE WHEN T11._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T11._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  59. 0x01 AS Q_002_F_000_
  60. FROM dbo._InfoRg11710 T17
  61. WHERE ((T17._Fld595 = @P17)) AND ((T17._Fld12072RRef = T13._IDRRef) AND (T17._Fld12073_TYPE = CASE WHEN T11._Fld12836RRef IS NOT NULL THEN 0x08 END AND T17._Fld12073_RTRef = CASE WHEN T11._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T17._Fld12073_RRRef = T11._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  62. 0x01 AS Q_003_F_000_
  63. FROM dbo._InfoRg11715 T18
  64. WHERE ((T18._Fld595 = @P18)) AND ((T18._Fld12199RRef = T13._IDRRef) AND T18._Fld12200_TYPE = CASE WHEN T11._Fld12836RRef IS NOT NULL THEN 0x08 END AND T18._Fld12200_RTRef = CASE WHEN T11._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T18._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T2._Period >= @P19 AND T2._Period < @P20 AND (T2._Fld11303 <> @P21 OR T2._Fld11302 <> @P22))
  65. GROUP BY T2._Fld11295RRef,
  66. T2._Fld11290_TYPE,
  67. T2._Fld11290_RTRef,
  68. T2._Fld11290_RRRef,
  69. T2._Fld11293_TYPE,
  70. T2._Fld11293_RTRef,
  71. T2._Fld11293_RRRef
  72. HAVING (CAST(SUM(T2._Fld11303) AS NUMERIC(33, 8))) <> 0.0 OR (CAST(SUM(T2._Fld11302) AS NUMERIC(33, 8))) <> 0.0) T1
  73. LEFT OUTER JOIN (SELECT
  74. T20._IDRRef AS IDRRef,
  75. T20._Fld4625RRef AS Fld4625RRef,
  76. T20._Fld595 AS Fld595_
  77. FROM dbo._Document233 T20
  78. WHERE ((EXISTS(SELECT
  79. 1
  80. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  81. LEFT OUTER JOIN dbo._Reference42 T21
  82. ON ((T20._Fld4625RRef = T21._IDRRef)) AND (T21._Fld595 = @P23)
  83. WHERE EXISTS(SELECT
  84. 0x01 AS Q_001_F_000_
  85. FROM dbo._Reference98 T22
  86. INNER JOIN dbo._Reference21 T23
  87. ON (((T22._Fld1685 = @P24) AND EXISTS(SELECT
  88. 0x01 AS Q_004_F_000_
  89. FROM dbo._InfoRg11709 T24
  90. WHERE ((T24._Fld595 = @P25)) AND ((T24._Fld12065RRef = T22._IDRRef) AND (T24._Fld12066RRef = T23._IDRRef)))) AND T23._IDRRef IN
  91. (SELECT
  92. T25._Reference21_IDRRef AS Q_005_F_000RRef
  93. FROM dbo._Reference21_VT782 T25
  94. INNER JOIN dbo._InfoRg9937 T26
  95. ON ((T26._Fld9939_TYPE = 0x08 AND T26._Fld9939_RTRef = 0x00000095 AND T26._Fld9939_RRRef = @P26) AND (T26._Fld9938_TYPE = T25._Fld784_TYPE AND T26._Fld9938_RTRef = T25._Fld784_RTRef AND T26._Fld9938_RRRef = T25._Fld784_RRRef))
  96. WHERE ((T25._Fld595 = @P27)) AND (T26._Fld595 = @P28)))
  97. WHERE ((T23._Fld595 = @P29)) AND ((CASE WHEN T21._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T21._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  98. 0x01 AS Q_002_F_000_
  99. FROM dbo._InfoRg11710 T27
  100. WHERE ((T27._Fld595 = @P30)) AND ((T27._Fld12072RRef = T23._IDRRef) AND (T27._Fld12073_TYPE = CASE WHEN T21._Fld12836RRef IS NOT NULL THEN 0x08 END AND T27._Fld12073_RTRef = CASE WHEN T21._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T27._Fld12073_RRRef = T21._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  101. 0x01 AS Q_003_F_000_
  102. FROM dbo._InfoRg11715 T28
  103. WHERE ((T28._Fld595 = @P31)) AND ((T28._Fld12199RRef = T23._IDRRef) AND T28._Fld12200_TYPE = CASE WHEN T21._Fld12836RRef IS NOT NULL THEN 0x08 END AND T28._Fld12200_RTRef = CASE WHEN T21._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T28._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T20._Fld595 = @P32)) T19
  104. ON T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000E9 AND T1.Fld11293_RRRef = T19.IDRRef
  105. LEFT OUTER JOIN dbo._Document212 T29
  106. ON (T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000D4 AND T1.Fld11293_RRRef = T29._IDRRef) AND (T29._Fld595 = @P33)
  107. LEFT OUTER JOIN (SELECT
  108. T31._IDRRef AS IDRRef,
  109. T31._Fld595 AS Fld595_,
  110. T31._Fld4774RRef AS Fld4774RRef,
  111. T31._Fld4779RRef AS Fld4779RRef
  112. FROM dbo._Document234 T31
  113. WHERE ((EXISTS(SELECT
  114. 1
  115. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  116. LEFT OUTER JOIN dbo._Reference42 T32
  117. ON ((T31._Fld4774RRef = T32._IDRRef)) AND (T32._Fld595 = @P34)
  118. WHERE EXISTS(SELECT
  119. 0x01 AS Q_001_F_000_
  120. FROM dbo._Reference98 T33
  121. INNER JOIN dbo._Reference21 T34
  122. ON (((T33._Fld1685 = @P35) AND EXISTS(SELECT
  123. 0x01 AS Q_006_F_000_
  124. FROM dbo._InfoRg11709 T35
  125. WHERE ((T35._Fld595 = @P36)) AND ((T35._Fld12065RRef = T33._IDRRef) AND (T35._Fld12066RRef = T34._IDRRef)))) AND T34._IDRRef IN
  126. (SELECT
  127. T36._Reference21_IDRRef AS Q_007_F_000RRef
  128. FROM dbo._Reference21_VT782 T36
  129. INNER JOIN dbo._InfoRg9937 T37
  130. ON ((T37._Fld9939_TYPE = 0x08 AND T37._Fld9939_RTRef = 0x00000095 AND T37._Fld9939_RRRef = @P37) AND (T37._Fld9938_TYPE = T36._Fld784_TYPE AND T37._Fld9938_RTRef = T36._Fld784_RTRef AND T37._Fld9938_RRRef = T36._Fld784_RRRef))
  131. WHERE ((T36._Fld595 = @P38)) AND (T37._Fld595 = @P39)))
  132. WHERE ((T34._Fld595 = @P40)) AND ((0x08 <> 0x01) AND (CASE WHEN EXISTS(SELECT
  133. 0x01 AS Q_002_F_000_
  134. FROM dbo._InfoRg11710 T38
  135. WHERE ((T38._Fld595 = @P41)) AND ((T38._Fld12072RRef = T34._IDRRef) AND (T38._Fld12073_TYPE = 0x08 AND T38._Fld12073_RTRef = 0x0000001C AND T38._Fld12073_RRRef = T31._Fld4779RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  136. 0x01 AS Q_003_F_000_
  137. FROM dbo._InfoRg11715 T39
  138. WHERE ((T39._Fld595 = @P42)) AND ((T39._Fld12199RRef = T34._IDRRef) AND T39._Fld12200_TYPE = 0x08 AND T39._Fld12200_RTRef = 0x0000001C AND (T39._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END) AND (CASE WHEN T32._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T32._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  139. 0x01 AS Q_004_F_000_
  140. FROM dbo._InfoRg11710 T40
  141. WHERE ((T40._Fld595 = @P43)) AND ((T40._Fld12072RRef = T34._IDRRef) AND (T40._Fld12073_TYPE = CASE WHEN T32._Fld12836RRef IS NOT NULL THEN 0x08 END AND T40._Fld12073_RTRef = CASE WHEN T32._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T40._Fld12073_RRRef = T32._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  142. 0x01 AS Q_005_F_000_
  143. FROM dbo._InfoRg11715 T41
  144. WHERE ((T41._Fld595 = @P44)) AND ((T41._Fld12199RRef = T34._IDRRef) AND T41._Fld12200_TYPE = CASE WHEN T32._Fld12836RRef IS NOT NULL THEN 0x08 END AND T41._Fld12200_RTRef = CASE WHEN T32._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T41._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T31._Fld595 = @P45)) T30
  145. ON T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000EA AND T1.Fld11293_RRRef = T30.IDRRef
  146. LEFT OUTER JOIN dbo._Document263 T42
  147. ON (T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x00000107 AND T1.Fld11293_RRRef = T42._IDRRef) AND (T42._Fld595 = @P46)
  148. LEFT OUTER JOIN (SELECT
  149. T44._Fld3845RRef AS Fld3845RRef,
  150. T44._IDRRef AS IDRRef,
  151. T44._Fld595 AS Fld595_
  152. FROM dbo._Document216 T44
  153. WHERE ((EXISTS(SELECT
  154. 1
  155. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  156. LEFT OUTER JOIN dbo._Reference42 T45
  157. ON ((T44._Fld3845RRef = T45._IDRRef)) AND (T45._Fld595 = @P47)
  158. WHERE EXISTS(SELECT
  159. 0x01 AS Q_001_F_000_
  160. FROM dbo._Reference98 T46
  161. INNER JOIN dbo._Reference21 T47
  162. ON (((T46._Fld1685 = @P48) AND EXISTS(SELECT
  163. 0x01 AS Q_004_F_000_
  164. FROM dbo._InfoRg11709 T48
  165. WHERE ((T48._Fld595 = @P49)) AND ((T48._Fld12065RRef = T46._IDRRef) AND (T48._Fld12066RRef = T47._IDRRef)))) AND T47._IDRRef IN
  166. (SELECT
  167. T49._Reference21_IDRRef AS Q_005_F_000RRef
  168. FROM dbo._Reference21_VT782 T49
  169. INNER JOIN dbo._InfoRg9937 T50
  170. ON ((T50._Fld9939_TYPE = 0x08 AND T50._Fld9939_RTRef = 0x00000095 AND T50._Fld9939_RRRef = @P50) AND (T50._Fld9938_TYPE = T49._Fld784_TYPE AND T50._Fld9938_RTRef = T49._Fld784_RTRef AND T50._Fld9938_RRRef = T49._Fld784_RRRef))
  171. WHERE ((T49._Fld595 = @P51)) AND (T50._Fld595 = @P52)))
  172. WHERE ((T47._Fld595 = @P53)) AND ((CASE WHEN T45._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T45._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  173. 0x01 AS Q_002_F_000_
  174. FROM dbo._InfoRg11710 T51
  175. WHERE ((T51._Fld595 = @P54)) AND ((T51._Fld12072RRef = T47._IDRRef) AND (T51._Fld12073_TYPE = CASE WHEN T45._Fld12836RRef IS NOT NULL THEN 0x08 END AND T51._Fld12073_RTRef = CASE WHEN T45._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T51._Fld12073_RRRef = T45._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  176. 0x01 AS Q_003_F_000_
  177. FROM dbo._InfoRg11715 T52
  178. WHERE ((T52._Fld595 = @P55)) AND ((T52._Fld12199RRef = T47._IDRRef) AND T52._Fld12200_TYPE = CASE WHEN T45._Fld12836RRef IS NOT NULL THEN 0x08 END AND T52._Fld12200_RTRef = CASE WHEN T45._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T52._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T44._Fld595 = @P56)) T43
  179. ON T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000D8 AND T1.Fld11293_RRRef = T43.IDRRef
  180. LEFT OUTER JOIN (SELECT
  181. T54._IDRRef AS IDRRef,
  182. T54._Fld595 AS Fld595_,
  183. T54._Fld3734RRef AS Fld3734RRef
  184. FROM dbo._Document215 T54
  185. WHERE ((EXISTS(SELECT
  186. 1
  187. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  188. LEFT OUTER JOIN dbo._Reference42 T55
  189. ON ((T54._Fld3734RRef = T55._IDRRef)) AND (T55._Fld595 = @P57)
  190. WHERE EXISTS(SELECT
  191. 0x01 AS Q_001_F_000_
  192. FROM dbo._Reference98 T56
  193. INNER JOIN dbo._Reference21 T57
  194. ON (((T56._Fld1685 = @P58) AND EXISTS(SELECT
  195. 0x01 AS Q_004_F_000_
  196. FROM dbo._InfoRg11709 T58
  197. WHERE ((T58._Fld595 = @P59)) AND ((T58._Fld12065RRef = T56._IDRRef) AND (T58._Fld12066RRef = T57._IDRRef)))) AND T57._IDRRef IN
  198. (SELECT
  199. T59._Reference21_IDRRef AS Q_005_F_000RRef
  200. FROM dbo._Reference21_VT782 T59
  201. INNER JOIN dbo._InfoRg9937 T60
  202. ON ((T60._Fld9939_TYPE = 0x08 AND T60._Fld9939_RTRef = 0x00000095 AND T60._Fld9939_RRRef = @P60) AND (T60._Fld9938_TYPE = T59._Fld784_TYPE AND T60._Fld9938_RTRef = T59._Fld784_RTRef AND T60._Fld9938_RRRef = T59._Fld784_RRRef))
  203. WHERE ((T59._Fld595 = @P61)) AND (T60._Fld595 = @P62)))
  204. WHERE ((T57._Fld595 = @P63)) AND ((CASE WHEN T55._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T55._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  205. 0x01 AS Q_002_F_000_
  206. FROM dbo._InfoRg11710 T61
  207. WHERE ((T61._Fld595 = @P64)) AND ((T61._Fld12072RRef = T57._IDRRef) AND (T61._Fld12073_TYPE = CASE WHEN T55._Fld12836RRef IS NOT NULL THEN 0x08 END AND T61._Fld12073_RTRef = CASE WHEN T55._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T61._Fld12073_RRRef = T55._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  208. 0x01 AS Q_003_F_000_
  209. FROM dbo._InfoRg11715 T62
  210. WHERE ((T62._Fld595 = @P65)) AND ((T62._Fld12199RRef = T57._IDRRef) AND T62._Fld12200_TYPE = CASE WHEN T55._Fld12836RRef IS NOT NULL THEN 0x08 END AND T62._Fld12200_RTRef = CASE WHEN T55._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T62._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T54._Fld595 = @P66)) T53
  211. ON T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000D7 AND T1.Fld11293_RRRef = T53.IDRRef
  212. LEFT OUTER JOIN dbo._Document213 T63
  213. ON (T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000D5 AND T1.Fld11293_RRRef = T63._IDRRef) AND (T63._Fld595 = @P67)
  214. LEFT OUTER JOIN dbo._Document199 T64
  215. ON (T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000C7 AND T1.Fld11293_RRRef = T64._IDRRef) AND (T64._Fld595 = @P68)
  216. LEFT OUTER JOIN (SELECT
  217. T66._IDRRef AS IDRRef,
  218. T66._Folder AS Folder_,
  219. T66._Fld12836RRef AS Fld12836RRef,
  220. T66._Fld595 AS Fld595_
  221. FROM dbo._Reference42 T66
  222. WHERE ((((T66._Folder = 0x00) OR EXISTS(SELECT
  223. 0x01 AS Q_001_F_000_
  224. FROM dbo._Reference98 T67
  225. INNER JOIN dbo._Reference21 T68
  226. ON (((T67._Fld1685 = @P69) AND EXISTS(SELECT
  227. 0x01 AS Q_004_F_000_
  228. FROM dbo._InfoRg11709 T69
  229. WHERE ((T69._Fld595 = @P70)) AND ((T69._Fld12065RRef = T67._IDRRef) AND (T69._Fld12066RRef = T68._IDRRef)))) AND T68._IDRRef IN
  230. (SELECT
  231. T70._Reference21_IDRRef AS Q_005_F_000RRef
  232. FROM dbo._Reference21_VT782 T70
  233. INNER JOIN dbo._InfoRg9937 T71
  234. ON ((T71._Fld9939_TYPE = 0x08 AND T71._Fld9939_RTRef = 0x00000095 AND T71._Fld9939_RRRef = @P71) AND (T71._Fld9938_TYPE = T70._Fld784_TYPE AND T71._Fld9938_RTRef = T70._Fld784_RTRef AND T71._Fld9938_RRRef = T70._Fld784_RRRef))
  235. WHERE ((T70._Fld595 = @P72)) AND (T71._Fld595 = @P73)))
  236. WHERE ((T68._Fld595 = @P74)) AND ((CASE WHEN T66._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T66._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  237. 0x01 AS Q_002_F_000_
  238. FROM dbo._InfoRg11710 T72
  239. WHERE ((T72._Fld595 = @P75)) AND ((T72._Fld12072RRef = T68._IDRRef) AND (T72._Fld12073_TYPE = CASE WHEN T66._Fld12836RRef IS NOT NULL THEN 0x08 END AND T72._Fld12073_RTRef = CASE WHEN T66._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T72._Fld12073_RRRef = T66._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  240. 0x01 AS Q_003_F_000_
  241. FROM dbo._InfoRg11715 T73
  242. WHERE ((T73._Fld595 = @P76)) AND ((T73._Fld12199RRef = T68._IDRRef) AND T73._Fld12200_TYPE = CASE WHEN T66._Fld12836RRef IS NOT NULL THEN 0x08 END AND T73._Fld12200_RTRef = CASE WHEN T66._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T73._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T66._Fld595 = @P77)) T65
  243. ON (CASE WHEN T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000E9 THEN T19.Fld4625RRef WHEN T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000D4 THEN T29._Fld3516RRef WHEN T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000EA THEN T30.Fld4774RRef WHEN T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x00000107 THEN T42._Fld6287RRef WHEN T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000D8 THEN T43.Fld3845RRef WHEN T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000D7 THEN T53.Fld3734RRef WHEN T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000D5 THEN T63._Fld3600RRef WHEN T1.Fld11293_TYPE = 0x08 AND T1.Fld11293_RTRef = 0x000000C7 THEN T64._Fld2840RRef ELSE CAST(NULL AS BINARY(16)) END = T65.IDRRef)
  244. LEFT OUTER JOIN dbo._Reference88 T74
  245. ON (T1.Fld11290_TYPE = 0x08 AND T1.Fld11290_RTRef = 0x00000058 AND T1.Fld11290_RRRef = T74._IDRRef) AND (T74._Fld595 = @P78)
  246. UNION ALL SELECT
  247. T75.Fld10332_TYPE,
  248. T75.Fld10332_RTRef,
  249. T75.Fld10332_RRRef,
  250. T75.Fld10328RRef,
  251. CAST(NULL AS NUMERIC(28, 2)),
  252. T75.Fld10330RRef,
  253. CAST(NULL AS NUMERIC(28, 2)),
  254. CAST(NULL AS NUMERIC(28, 2)),
  255. T75.Fld10334Expense_,
  256. CAST(NULL AS NUMERIC(21, 2))
  257. FROM (SELECT
  258. T76._RecorderTRef AS RecorderTRef,
  259. T76._RecorderRRef AS RecorderRRef,
  260. T76._Fld10328RRef AS Fld10328RRef,
  261. T76._Fld10330RRef AS Fld10330RRef,
  262. T76._Fld10332_TYPE AS Fld10332_TYPE,
  263. T76._Fld10332_RTRef AS Fld10332_RTRef,
  264. T76._Fld10332_RRRef AS Fld10332_RRRef,
  265. CAST(SUM(CASE WHEN T76._RecordKind = 0.0 THEN 0.0 ELSE T76._Fld10334 END) AS NUMERIC(27, 8)) AS Fld10334Expense_
  266. FROM dbo._AccumRg10327 T76
  267. WHERE (((T76._Fld595 = @P79)) AND (EXISTS(SELECT
  268. 1
  269. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  270. LEFT OUTER JOIN dbo._Reference42 T77
  271. ON ((T76._Fld10330RRef = T77._IDRRef)) AND (T77._Fld595 = @P80)
  272. WHERE EXISTS(SELECT
  273. 0x01 AS Q_001_F_000_
  274. FROM dbo._Reference98 T78
  275. INNER JOIN dbo._Reference21 T79
  276. ON (((T78._Fld1685 = @P81) AND EXISTS(SELECT
  277. 0x01 AS Q_004_F_000_
  278. FROM dbo._InfoRg11709 T80
  279. WHERE ((T80._Fld595 = @P82)) AND ((T80._Fld12065RRef = T78._IDRRef) AND (T80._Fld12066RRef = T79._IDRRef)))) AND T79._IDRRef IN
  280. (SELECT
  281. T81._Reference21_IDRRef AS Q_005_F_000RRef
  282. FROM dbo._Reference21_VT782 T81
  283. INNER JOIN dbo._InfoRg9937 T82
  284. ON ((T82._Fld9939_TYPE = 0x08 AND T82._Fld9939_RTRef = 0x00000095 AND T82._Fld9939_RRRef = @P83) AND (T82._Fld9938_TYPE = T81._Fld784_TYPE AND T82._Fld9938_RTRef = T81._Fld784_RTRef AND T82._Fld9938_RRRef = T81._Fld784_RRRef))
  285. WHERE ((T81._Fld595 = @P84)) AND (T82._Fld595 = @P85)))
  286. WHERE ((T79._Fld595 = @P86)) AND ((CASE WHEN T77._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T77._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  287. 0x01 AS Q_002_F_000_
  288. FROM dbo._InfoRg11710 T83
  289. WHERE ((T83._Fld595 = @P87)) AND ((T83._Fld12072RRef = T79._IDRRef) AND (T83._Fld12073_TYPE = CASE WHEN T77._Fld12836RRef IS NOT NULL THEN 0x08 END AND T83._Fld12073_RTRef = CASE WHEN T77._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T83._Fld12073_RRRef = T77._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  290. 0x01 AS Q_003_F_000_
  291. FROM dbo._InfoRg11715 T84
  292. WHERE ((T84._Fld595 = @P88)) AND ((T84._Fld12199RRef = T79._IDRRef) AND T84._Fld12200_TYPE = CASE WHEN T77._Fld12836RRef IS NOT NULL THEN 0x08 END AND T84._Fld12200_RTRef = CASE WHEN T77._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T84._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T76._Period >= @P89 AND T76._Period <= @P90 AND T76._Active = 0x01 AND (0x00) = 0x01 AND T76._RecordKind = @P91)
  293. GROUP BY T76._RecorderTRef,
  294. T76._RecorderRRef,
  295. T76._Fld10328RRef,
  296. T76._Fld10330RRef,
  297. T76._Fld10332_TYPE,
  298. T76._Fld10332_RTRef,
  299. T76._Fld10332_RRRef
  300. HAVING (CAST(SUM(CASE WHEN T76._RecordKind = 0.0 THEN 0.0 ELSE T76._Fld10334 END) AS NUMERIC(27, 8))) <> 0.0) T75
  301. WHERE (T75.RecorderTRef = 0x000000D3)
  302. UNION ALL SELECT
  303. T85.Fld10540_TYPE,
  304. T85.Fld10540_RTRef,
  305. T85.Fld10540_RRRef,
  306. T85.Fld10536RRef,
  307. CAST(NULL AS NUMERIC(28, 2)),
  308. T85.Fld10538RRef,
  309. CAST(NULL AS NUMERIC(28, 2)),
  310. CAST(NULL AS NUMERIC(28, 2)),
  311. T85.Fld10544Expense_,
  312. CAST(NULL AS NUMERIC(21, 2))
  313. FROM (SELECT
  314. T86._RecorderTRef AS RecorderTRef,
  315. T86._RecorderRRef AS RecorderRRef,
  316. T86._Fld10536RRef AS Fld10536RRef,
  317. T86._Fld10538RRef AS Fld10538RRef,
  318. T86._Fld10540_TYPE AS Fld10540_TYPE,
  319. T86._Fld10540_RTRef AS Fld10540_RTRef,
  320. T86._Fld10540_RRRef AS Fld10540_RRRef,
  321. CAST(SUM(CASE WHEN T86._RecordKind = 0.0 THEN 0.0 ELSE T86._Fld10544 END) AS NUMERIC(27, 8)) AS Fld10544Expense_
  322. FROM dbo._AccumRg10535 T86
  323. WHERE (((T86._Fld595 = @P92)) AND (EXISTS(SELECT
  324. 1
  325. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  326. LEFT OUTER JOIN dbo._Reference42 T87
  327. ON ((T86._Fld10538RRef = T87._IDRRef)) AND (T87._Fld595 = @P93)
  328. WHERE EXISTS(SELECT
  329. 0x01 AS Q_001_F_000_
  330. FROM dbo._Reference98 T88
  331. INNER JOIN dbo._Reference21 T89
  332. ON (((T88._Fld1685 = @P94) AND EXISTS(SELECT
  333. 0x01 AS Q_004_F_000_
  334. FROM dbo._InfoRg11709 T90
  335. WHERE ((T90._Fld595 = @P95)) AND ((T90._Fld12065RRef = T88._IDRRef) AND (T90._Fld12066RRef = T89._IDRRef)))) AND T89._IDRRef IN
  336. (SELECT
  337. T91._Reference21_IDRRef AS Q_005_F_000RRef
  338. FROM dbo._Reference21_VT782 T91
  339. INNER JOIN dbo._InfoRg9937 T92
  340. ON ((T92._Fld9939_TYPE = 0x08 AND T92._Fld9939_RTRef = 0x00000095 AND T92._Fld9939_RRRef = @P96) AND (T92._Fld9938_TYPE = T91._Fld784_TYPE AND T92._Fld9938_RTRef = T91._Fld784_RTRef AND T92._Fld9938_RRRef = T91._Fld784_RRRef))
  341. WHERE ((T91._Fld595 = @P97)) AND (T92._Fld595 = @P98)))
  342. WHERE ((T89._Fld595 = @P99)) AND ((CASE WHEN T87._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T87._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  343. 0x01 AS Q_002_F_000_
  344. FROM dbo._InfoRg11710 T93
  345. WHERE ((T93._Fld595 = @P100)) AND ((T93._Fld12072RRef = T89._IDRRef) AND (T93._Fld12073_TYPE = CASE WHEN T87._Fld12836RRef IS NOT NULL THEN 0x08 END AND T93._Fld12073_RTRef = CASE WHEN T87._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T93._Fld12073_RRRef = T87._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  346. 0x01 AS Q_003_F_000_
  347. FROM dbo._InfoRg11715 T94
  348. WHERE ((T94._Fld595 = @P101)) AND ((T94._Fld12199RRef = T89._IDRRef) AND T94._Fld12200_TYPE = CASE WHEN T87._Fld12836RRef IS NOT NULL THEN 0x08 END AND T94._Fld12200_RTRef = CASE WHEN T87._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T94._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T86._Period >= @P102 AND T86._Period <= @P103 AND T86._Active = 0x01 AND T86._RecordKind = @P104)
  349. GROUP BY T86._RecorderTRef,
  350. T86._RecorderRRef,
  351. T86._Fld10536RRef,
  352. T86._Fld10538RRef,
  353. T86._Fld10540_TYPE,
  354. T86._Fld10540_RTRef,
  355. T86._Fld10540_RRRef
  356. HAVING (CAST(SUM(CASE WHEN T86._RecordKind = 0.0 THEN 0.0 ELSE T86._Fld10544 END) AS NUMERIC(27, 8))) <> 0.0) T85
  357. WHERE ((T85.RecorderTRef = 0x00000103) OR (T85.RecorderTRef = 0x000000FF))
  358. UNION ALL SELECT
  359. T95.Fld10332_TYPE,
  360. T95.Fld10332_RTRef,
  361. T95.Fld10332_RRRef,
  362. T95.Fld10328RRef,
  363. CAST(NULL AS NUMERIC(28, 2)),
  364. T95.Fld10330RRef,
  365. CAST(NULL AS NUMERIC(28, 2)),
  366. CAST(NULL AS NUMERIC(28, 2)),
  367. CAST(NULL AS NUMERIC(21, 2)),
  368. T95.Fld10334Receipt_
  369. FROM (SELECT
  370. T96._RecorderTRef AS RecorderTRef,
  371. T96._RecorderRRef AS RecorderRRef,
  372. T96._Fld10328RRef AS Fld10328RRef,
  373. T96._Fld10330RRef AS Fld10330RRef,
  374. T96._Fld10332_TYPE AS Fld10332_TYPE,
  375. T96._Fld10332_RTRef AS Fld10332_RTRef,
  376. T96._Fld10332_RRRef AS Fld10332_RRRef,
  377. CAST(SUM(CASE WHEN T96._RecordKind = 0.0 THEN T96._Fld10334 ELSE 0.0 END) AS NUMERIC(27, 8)) AS Fld10334Receipt_
  378. FROM dbo._AccumRg10327 T96
  379. WHERE (((T96._Fld595 = @P105)) AND (EXISTS(SELECT
  380. 1
  381. FROM (SELECT 1 AS SDBL_DUMMY) SDBL_DUAL
  382. LEFT OUTER JOIN dbo._Reference42 T97
  383. ON ((T96._Fld10330RRef = T97._IDRRef)) AND (T97._Fld595 = @P106)
  384. WHERE EXISTS(SELECT
  385. 0x01 AS Q_001_F_000_
  386. FROM dbo._Reference98 T98
  387. INNER JOIN dbo._Reference21 T99
  388. ON (((T98._Fld1685 = @P107) AND EXISTS(SELECT
  389. 0x01 AS Q_004_F_000_
  390. FROM dbo._InfoRg11709 T100
  391. WHERE ((T100._Fld595 = @P108)) AND ((T100._Fld12065RRef = T98._IDRRef) AND (T100._Fld12066RRef = T99._IDRRef)))) AND T99._IDRRef IN
  392. (SELECT
  393. T101._Reference21_IDRRef AS Q_005_F_000RRef
  394. FROM dbo._Reference21_VT782 T101
  395. INNER JOIN dbo._InfoRg9937 T102
  396. ON ((T102._Fld9939_TYPE = 0x08 AND T102._Fld9939_RTRef = 0x00000095 AND T102._Fld9939_RRRef = @P109) AND (T102._Fld9938_TYPE = T101._Fld784_TYPE AND T102._Fld9938_RTRef = T101._Fld784_RTRef AND T102._Fld9938_RRRef = T101._Fld784_RRRef))
  397. WHERE ((T101._Fld595 = @P110)) AND (T102._Fld595 = @P111)))
  398. WHERE ((T99._Fld595 = @P112)) AND ((CASE WHEN T97._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T97._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  399. 0x01 AS Q_002_F_000_
  400. FROM dbo._InfoRg11710 T103
  401. WHERE ((T103._Fld595 = @P113)) AND ((T103._Fld12072RRef = T99._IDRRef) AND (T103._Fld12073_TYPE = CASE WHEN T97._Fld12836RRef IS NOT NULL THEN 0x08 END AND T103._Fld12073_RTRef = CASE WHEN T97._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T103._Fld12073_RRRef = T97._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  402. 0x01 AS Q_003_F_000_
  403. FROM dbo._InfoRg11715 T104
  404. WHERE ((T104._Fld595 = @P114)) AND ((T104._Fld12199RRef = T99._IDRRef) AND T104._Fld12200_TYPE = CASE WHEN T97._Fld12836RRef IS NOT NULL THEN 0x08 END AND T104._Fld12200_RTRef = CASE WHEN T97._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T104._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND (T96._Period >= @P115 AND T96._Period <= @P116 AND T96._Active = 0x01 AND (0x00) = 0x01 AND T96._RecordKind = @P117)
  405. GROUP BY T96._RecorderTRef,
  406. T96._RecorderRRef,
  407. T96._Fld10328RRef,
  408. T96._Fld10330RRef,
  409. T96._Fld10332_TYPE,
  410. T96._Fld10332_RTRef,
  411. T96._Fld10332_RRRef
  412. HAVING (CAST(SUM(CASE WHEN T96._RecordKind = 0.0 THEN T96._Fld10334 ELSE 0.0 END) AS NUMERIC(27, 8))) <> 0.0) T95
  413. WHERE (T95.RecorderTRef = 0x000000D1)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top