Advertisement
bytecoded

Query #5

Mar 8th, 2019
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 3.98 KB | None | 0 0
  1. )SELECT TOP 25
  2. T1._IDRRef,
  3. T1._Description,
  4. T1._Code,
  5. T1._Fld1033,
  6. T1._Fld1038RRef,
  7. T1._Fld1028RRef,
  8. T58._Fld885,
  9. T59._Fld885,
  10. T2.Q_001_F_001_,
  11. T12.Q_001_F_001_,
  12. T22.Q_001_F_001_,
  13. T32.Q_001_F_001_,
  14. T42.Q_001_F_001_,
  15. T52.Q_001_F_001_,
  16. T54.Q_001_F_001_,
  17. T56.Q_001_F_001_,
  18. T1._Marked,
  19. T1._ParentIDRRef,
  20. CASE WHEN (T1._Folder = 0x00) THEN 0x01 ELSE 0x00 END,
  21. CASE WHEN T1._PredefinedID > 0x00000000000000000000000000000000 THEN 0x01 ELSE 0x00 END,
  22. T1._Fld1040RRef,
  23. T1._Fld12739RRef
  24. FROM dbo._Reference42 T1
  25. LEFT OUTER JOIN (SELECT
  26. T3._Reference42_IDRRef AS Q_001_F_000RRef,
  27. T3._Fld1050 COLLATE Latin1_General_CI_AS AS Q_001_F_001_
  28. FROM dbo._Reference42_VT1046 T3
  29. INNER JOIN dbo._Reference42 T4
  30. ON T3._Reference42_IDRRef = T4._IDRRef AND T3._Fld595 = T4._Fld595
  31. WHERE (((T3._Fld595 = @P1)) AND (((T4._Folder = 0x00) OR EXISTS(SELECT
  32. 0x01 AS Q_001_F_000_
  33. FROM dbo._Reference98 T5
  34. INNER JOIN dbo._Reference21 T6
  35. ON (((T5._Fld1685 = @P2) AND EXISTS(SELECT
  36. 0x01 AS Q_004_F_000_
  37. FROM dbo._InfoRg11709 T7
  38. WHERE ((T7._Fld595 = @P3)) AND ((T7._Fld12065RRef = T5._IDRRef) AND (T7._Fld12066RRef = T6._IDRRef)))) AND T6._IDRRef IN
  39. (SELECT
  40. T8._Reference21_IDRRef AS Q_005_F_000RRef
  41. FROM dbo._Reference21_VT782 T8
  42. INNER JOIN dbo._InfoRg9937 T9
  43. ON ((T9._Fld9939_TYPE = 0x08 AND T9._Fld9939_RTRef = 0x00000095 AND T9._Fld9939_RRRef = @P4) AND (T9._Fld9938_TYPE = T8._Fld784_TYPE AND T9._Fld9938_RTRef = T8._Fld784_RTRef AND T9._Fld9938_RRRef = T8._Fld784_RRRef))
  44. WHERE ((T8._Fld595 = @P5)) AND (T9._Fld595 = @P6)))
  45. WHERE ((T6._Fld595 = @P7)) AND ((CASE WHEN T4._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T4._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  46. 0x01 AS Q_002_F_000_
  47. FROM dbo._InfoRg11710 T10
  48. WHERE ((T10._Fld595 = @P8)) AND ((T10._Fld12072RRef = T6._IDRRef) AND (T10._Fld12073_TYPE = CASE WHEN T4._Fld12836RRef IS NOT NULL THEN 0x08 END AND T10._Fld12073_RTRef = CASE WHEN T4._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T10._Fld12073_RRRef = T4._Fld12836RRef))) THEN 0x01 ELSE 0x00 END = CASE WHEN EXISTS(SELECT
  49. 0x01 AS Q_003_F_000_
  50. FROM dbo._InfoRg11715 T11
  51. WHERE ((T11._Fld595 = @P9)) AND ((T11._Fld12199RRef = T6._IDRRef) AND T11._Fld12200_TYPE = CASE WHEN T4._Fld12836RRef IS NOT NULL THEN 0x08 END AND T11._Fld12200_RTRef = CASE WHEN T4._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND (T11._Fld12201 = 0x00))) THEN 0x01 ELSE 0x00 END)))))) AND ((T3._Fld1049RRef = @P10))) T2
  52. ON (T1._IDRRef = T2.Q_001_F_000RRef)
  53. LEFT OUTER JOIN (SELECT
  54. T13._Reference42_IDRRef AS Q_001_F_000RRef,
  55. T13._Fld1050 COLLATE Latin1_General_CI_AS AS Q_001_F_001_
  56. FROM dbo._Reference42_VT1046 T13
  57. INNER JOIN dbo._Reference42 T14
  58. ON T13._Reference42_IDRRef = T14._IDRRef AND T13._Fld595 = T14._Fld595
  59. WHERE (((T13._Fld595 = @P11)) AND (((T14._Folder = 0x00) OR EXISTS(SELECT
  60. 0x01 AS Q_001_F_000_
  61. FROM dbo._Reference98 T15
  62. INNER JOIN dbo._Reference21 T16
  63. ON (((T15._Fld1685 = @P12) AND EXISTS(SELECT
  64. 0x01 AS Q_004_F_000_
  65. FROM dbo._InfoRg11709 T17
  66. WHERE ((T17._Fld595 = @P13)) AND ((T17._Fld12065RRef = T15._IDRRef) AND (T17._Fld12066RRef = T16._IDRRef)))) AND T16._IDRRef IN
  67. (SELECT
  68. T18._Reference21_IDRRef AS Q_005_F_000RRef
  69. FROM dbo._Reference21_VT782 T18
  70. INNER JOIN dbo._InfoRg9937 T19
  71. ON ((T19._Fld9939_TYPE = 0x08 AND T19._Fld9939_RTRef = 0x00000095 AND T19._Fld9939_RRRef = @P14) AND (T19._Fld9938_TYPE = T18._Fld784_TYPE AND T19._Fld9938_RTRef = T18._Fld784_RTRef AND T19._Fld9938_RRRef = T18._Fld784_RRRef))
  72. WHERE ((T18._Fld595 = @P15)) AND (T19._Fld595 = @P16)))
  73. WHERE ((T16._Fld595 = @P17)) AND ((CASE WHEN T14._Fld12836RRef IS NULL THEN 0x01 ELSE CASE WHEN T14._Fld12836RRef IS NOT NULL THEN 0x08 END END <> 0x01) AND (CASE WHEN EXISTS(SELECT
  74. 0x01 AS Q_002_F_000_
  75. FROM dbo._InfoRg11710 T20
  76. WHERE ((T20._Fld595 = @P18)) AND ((T20._Fld12072RRef = T16._IDRRef) AND (T20._Fld12073_TYPE = CASE WHEN T14._Fld12836RRef IS NOT NULL THEN 0x08 END AND T20._Fld12073_RTRef = CASE WHEN T14._Fld12836RRef IS NOT NULL THEN 0x0000001C END AND T20._Fld12073_RRRef = T14._Fld12836RRef))) THEN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement