dbCheckConsistency_db2.sql 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. -- Licensed Materials - Property of IBM
  2. --
  3. -- BI and PM: CM
  4. --
  5. -- (C) Copyright IBM Corp. 2008, 2019
  6. --
  7. -- US Government Users Restricted Rights - Use, duplication or disclosure
  8. -- restricted by GSA ADP Schedule Contract with IBM Corp.
  9. -- Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  10. -- Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  11. -- create a temporary table
  12. declare global temporary table CMCHECKCONSISTENCY (inconsistency integer not null, description varchar(255), CMID integer) with replace on commit preserve rows not logged;
  13. -- Records with inconsistency = 1 are related to CMIDs in property tables and not in CMOBJECTS table.
  14. -- Records with inconsistency = 2 are related to CMIDs in CMOBJECTS table but not in CMOBJNAMES or CMPOLICIES tables.
  15. -- Records with inconsistency = 3 are related to CMIDs in CMSTOREIDS table but STOREID value is null.
  16. -- Records with inconsistency = 4 are related to CMIDs in CMSTOREIDS table which have non-unique STOREIDs.
  17. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  18. select cast(1 as integer),'CMOBJNAMES', CMID from CMOBJNAMES where CMID not in (select CMID from CMOBJECTS);
  19. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  20. select cast(1 as integer),'CMDATA', CMID from CMDATA where CMID not in (select CMID from CMOBJECTS);
  21. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  22. select cast(1 as integer),'CMOBJPROPS1', CMID from CMOBJPROPS1 where CMID not in (select CMID from CMOBJECTS);
  23. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  24. select cast(1 as integer),'CMOBJPROPS2', CMID from CMOBJPROPS2 where CMID not in (select CMID from CMOBJECTS);
  25. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  26. select cast(1 as integer),'CMOBJPROPS3', CMID from CMOBJPROPS3 where CMID not in (select CMID from CMOBJECTS);
  27. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  28. select cast(1 as integer),'CMOBJPROPS4', CMID from CMOBJPROPS4 where CMID not in (select CMID from CMOBJECTS);
  29. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  30. select cast(1 as integer),'CMOBJPROPS5', CMID from CMOBJPROPS5 where CMID not in (select CMID from CMOBJECTS);
  31. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  32. select cast(1 as integer),'CMOBJPROPS6', CMID from CMOBJPROPS6 where CMID not in (select CMID from CMOBJECTS);
  33. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  34. select cast(1 as integer),'CMOBJPROPS7', CMID from CMOBJPROPS7 where CMID not in (select CMID from CMOBJECTS);
  35. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  36. select cast(1 as integer),'CMOBJPROPS9', CMID from CMOBJPROPS9 where CMID not in (select CMID from CMOBJECTS);
  37. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  38. select cast(1 as integer),'CMOBJPROPS10', CMID from CMOBJPROPS10 where CMID not in (select CMID from CMOBJECTS);
  39. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  40. select cast(1 as integer),'CMOBJPROPS11', CMID from CMOBJPROPS11 where CMID not in (select CMID from CMOBJECTS);
  41. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  42. select cast(1 as integer),'CMOBJPROPS13', CMID from CMOBJPROPS13 where CMID not in (select CMID from CMOBJECTS);
  43. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  44. select cast(1 as integer),'CMOBJPROPS14', CMID from CMOBJPROPS14 where CMID not in (select CMID from CMOBJECTS);
  45. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  46. select cast(1 as integer),'CMOBJPROPS15', CMID from CMOBJPROPS15 where CMID not in (select CMID from CMOBJECTS);
  47. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  48. select cast(1 as integer),'CMOBJPROPS16', CMID from CMOBJPROPS16 where CMID not in (select CMID from CMOBJECTS);
  49. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  50. select cast(1 as integer),'CMOBJPROPS17', CMID from CMOBJPROPS17 where CMID not in (select CMID from CMOBJECTS);
  51. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  52. select cast(1 as integer),'CMOBJPROPS18', CMID from CMOBJPROPS18 where CMID not in (select CMID from CMOBJECTS);
  53. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  54. select cast(1 as integer),'CMOBJPROPS20', CMID from CMOBJPROPS20 where CMID not in (select CMID from CMOBJECTS);
  55. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  56. select cast(1 as integer),'CMOBJPROPS23', CMID from CMOBJPROPS23 where CMID not in (select CMID from CMOBJECTS);
  57. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  58. select cast(1 as integer),'CMOBJPROPS24', CMID from CMOBJPROPS24 where CMID not in (select CMID from CMOBJECTS);
  59. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  60. select cast(1 as integer),'CMOBJPROPS25', CMID from CMOBJPROPS25 where CMID not in (select CMID from CMOBJECTS);
  61. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  62. select cast(1 as integer),'CMOBJPROPS26', CMID from CMOBJPROPS26 where CMID not in (select CMID from CMOBJECTS);
  63. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  64. select cast(1 as integer),'CMOBJPROPS27', CMID from CMOBJPROPS27 where CMID not in (select CMID from CMOBJECTS);
  65. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  66. select cast(1 as integer),'CMPOLICIES', CMID from CMPOLICIES where CMID not in (select CMID from CMOBJECTS);
  67. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  68. select cast(1 as integer),'CMVIEWED', CMID from CMVIEWED where CMID not in (select CMID from CMOBJECTS);
  69. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  70. select cast(1 as integer),'CMGUIDS', CMID from CMGUIDS where CMID not in (select CMID from CMOBJECTS);
  71. -- 1.1 only tables
  72. --#COMMENT
  73. --#COMMENT Ignore if the following insert failes
  74. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  75. select cast(1 as integer),'CMOBJPROPS8', CMID from CMOBJPROPS8 where CMID not in (select CMID from CMOBJECTS);
  76. --#COMMENT Ignore if the following insert failes
  77. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  78. select cast(1 as integer),'CMOBJPROPS12', CMID from CMOBJPROPS12 where CMID not in (select CMID from CMOBJECTS);
  79. --#COMMENT Ignore if the following insert failes
  80. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  81. select cast(1 as integer),'CMOBJPROPS19', CMID from CMOBJPROPS19 where CMID not in (select CMID from CMOBJECTS);
  82. --#COMMENT Ignore if the following insert failes
  83. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  84. select cast(1 as integer),'CMOBJPROPS21', CMID from CMOBJPROPS21 where CMID not in (select CMID from CMOBJECTS);
  85. --#COMMENT Ignore if the following insert failes
  86. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  87. select cast(1 as integer),'CMOBJPROPS22', CMID from CMOBJPROPS22 where CMID not in (select CMID from CMOBJECTS);
  88. -- 2.0 tables
  89. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  90. select cast(1 as integer),'CMOBJPROPS28', CMID from CMOBJPROPS28 where CMID not in (select CMID from CMOBJECTS);
  91. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  92. select cast(1 as integer),'CMOBJPROPS30', CMID from CMOBJPROPS30 where CMID not in (select CMID from CMOBJECTS);
  93. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  94. select cast(1 as integer),'CMOBJPROPS31', CMID from CMOBJPROPS31 where CMID not in (select CMID from CMOBJECTS);
  95. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  96. select cast(1 as integer),'CMOBJPROPS32', CMID from CMOBJPROPS32 where CMID not in (select CMID from CMOBJECTS);
  97. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  98. select cast(1 as integer),'CMOBJPROPS33', CMID from CMOBJPROPS33 where CMID not in (select CMID from CMOBJECTS);
  99. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  100. select cast(1 as integer),'CMOBJPROPS34', CMID from CMOBJPROPS34 where CMID not in (select CMID from CMOBJECTS);
  101. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  102. select cast(1 as integer),'CMOBJPROPS35', CMID from CMOBJPROPS35 where CMID not in (select CMID from CMOBJECTS);
  103. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  104. select cast(1 as integer),'CMOBJPROPS36', CMID from CMOBJPROPS36 where CMID not in (select CMID from CMOBJECTS);
  105. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  106. select cast(1 as integer),'CMOBJPROPS37', CMID from CMOBJPROPS37 where CMID not in (select CMID from CMOBJECTS);
  107. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  108. select cast(1 as integer),'CMOBJPROPS38', CMID from CMOBJPROPS38 where CMID not in (select CMID from CMOBJECTS);
  109. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  110. select cast(1 as integer),'CMOBJPROPS39', CMID from CMOBJPROPS39 where CMID not in (select CMID from CMOBJECTS);
  111. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  112. select cast(1 as integer),'CMOBJPROPS40', CMID from CMOBJPROPS40 where CMID not in (select CMID from CMOBJECTS);
  113. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  114. select cast(1 as integer),'CMOBJPROPS41', CMID from CMOBJPROPS41 where CMID not in (select CMID from CMOBJECTS);
  115. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  116. select cast(1 as integer),'CMOBJPROPS42', CMID from CMOBJPROPS42 where CMID not in (select CMID from CMOBJECTS);
  117. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  118. select cast(1 as integer),'CMOBJPROPS43', CMID from CMOBJPROPS43 where CMID not in (select CMID from CMOBJECTS);
  119. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  120. select cast(1 as integer),'CMOBJPROPS44', CMID from CMOBJPROPS44 where CMID not in (select CMID from CMOBJECTS);
  121. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  122. select cast(1 as integer),'CMOBJPROPS45', CMID from CMOBJPROPS45 where CMID not in (select CMID from CMOBJECTS);
  123. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  124. select cast(1 as integer),'CMOBJPROPS46', CMID from CMOBJPROPS46 where CMID not in (select CMID from CMOBJECTS);
  125. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  126. select cast(1 as integer),'CMREFNOORD1', CMID from CMREFNOORD1 where CMID not in (select CMID from CMOBJECTS);
  127. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  128. select cast(1 as integer),'CMREFNOORD2', CMID from CMREFNOORD1 where CMID not in (select CMID from CMOBJECTS);
  129. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  130. select cast(1 as integer),'CMREFORD1', CMID from CMREFORD1 where CMID not in (select CMID from CMOBJECTS);
  131. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  132. select cast(1 as integer),'CMSTOREIDS', CMID from CMSTOREIDS where CMID not in (select CMID from CMOBJECTS);
  133. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  134. select cast(4 as integer),'CMSTOREIDS', s.CMID from CMSTOREIDS s where UPPER(s.STOREID) in (select UPPERSTOREIDS.STOREID from (select b.CMID, UPPER(b.STOREID) as STOREID from CMSTOREIDS b) as UPPERSTOREIDS group by UPPERSTOREIDS.STOREID having COUNT(UPPERSTOREIDS.CMID) > 1);
  135. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  136. select cast(3 as integer),'CMSTOREIDS', CMID from CMSTOREIDS where STOREID is null;
  137. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  138. select cast(2 as integer),'CMOBJECTS', CMID from CMOBJECTS where CMID not in (select CMID from CMOBJNAMES) or CMID not in (select CMID from CMPOLICIES);
  139. -- 3.0 tables:
  140. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  141. select cast(1 as integer),'CMOBJPROPS47', CMID from CMOBJPROPS47 where CMID not in (select CMID from CMOBJECTS);
  142. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  143. select cast(1 as integer),'CMOBJPROPS48', CMID from CMOBJPROPS48 where CMID not in (select CMID from CMOBJECTS);
  144. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  145. select cast(1 as integer),'CMOBJPROPS49', CMID from CMOBJPROPS49 where CMID not in (select CMID from CMOBJECTS);
  146. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  147. select cast(1 as integer),'CMOBJPROPS50', CMID from CMOBJPROPS50 where CMID not in (select CMID from CMOBJECTS);
  148. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  149. select cast(1 as integer),'CMOBJPROPS51', CMID from CMOBJPROPS51 where CMID not in (select CMID from CMOBJECTS);
  150. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  151. select cast(1 as integer),'CMOBJPROPS52', CMID from CMOBJPROPS52 where CMID not in (select CMID from CMOBJECTS);
  152. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  153. select cast(1 as integer),'CMOBJPROPS53', CMID from CMOBJPROPS53 where CMID not in (select CMID from CMOBJECTS);
  154. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  155. select cast(1 as integer),'CMOBJPROPS54', CMID from CMOBJPROPS54 where CMID not in (select CMID from CMOBJECTS);
  156. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  157. select cast(1 as integer),'CMOBJPROPS55', CMID from CMOBJPROPS55 where CMID not in (select CMID from CMOBJECTS);
  158. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  159. select cast(1 as integer),'CMOBJPROPS56', CMID from CMOBJPROPS56 where CMID not in (select CMID from CMOBJECTS);
  160. -- 3.0 tables
  161. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  162. select cast(1 as integer),'CMOBJPROPS57', CMID from CMOBJPROPS57 where CMID not in (select CMID from CMOBJECTS);
  163. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  164. select cast(1 as integer),'CMOBJPROPS58', CMID from CMOBJPROPS58 where CMID not in (select CMID from CMOBJECTS);
  165. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  166. select cast(1 as integer),'CMOBJPROPS59', CMID from CMOBJPROPS59 where CMID not in (select CMID from CMOBJECTS);
  167. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  168. select cast(1 as integer),'CMOBJPROPS60', CMID from CMOBJPROPS60 where CMID not in (select CMID from CMOBJECTS);
  169. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  170. select cast(1 as integer),'CMOBJPROPS61', CMID from CMOBJPROPS61 where CMID not in (select CMID from CMOBJECTS);
  171. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  172. select cast(1 as integer),'CMOBJPROPS62', CMID from CMOBJPROPS62 where CMID not in (select CMID from CMOBJECTS);
  173. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  174. select cast(1 as integer),'CMOBJPROPS63', CMID from CMOBJPROPS63 where CMID not in (select CMID from CMOBJECTS);
  175. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  176. select cast(1 as integer),'CMOBJPROPS64', CMID from CMOBJPROPS64 where CMID not in (select CMID from CMOBJECTS);
  177. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  178. select cast(1 as integer),'CMOBJPROPS65', CMID from CMOBJPROPS65 where CMID not in (select CMID from CMOBJECTS);
  179. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  180. select cast(1 as integer),'CMOBJPROPS66', CMID from CMOBJPROPS66 where CMID not in (select CMID from CMOBJECTS);
  181. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  182. select cast(1 as integer),'CMOBJPROPS67', CMID from CMOBJPROPS67 where CMID not in (select CMID from CMOBJECTS);
  183. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  184. select cast(1 as integer),'CMOBJPROPS68', CMID from CMOBJPROPS68 where CMID not in (select CMID from CMOBJECTS);
  185. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  186. select cast(1 as integer),'CMOBJPROPS69', CMID from CMOBJPROPS69 where CMID not in (select CMID from CMOBJECTS);
  187. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  188. select cast(1 as integer),'CMOBJPROPS70', CMID from CMOBJPROPS70 where CMID not in (select CMID from CMOBJECTS);
  189. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  190. select cast(1 as integer),'CMOBJPROPS71', CMID from CMOBJPROPS71 where CMID not in (select CMID from CMOBJECTS);
  191. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  192. select cast(1 as integer),'CMOBJPROPS72', CMID from CMOBJPROPS72 where CMID not in (select CMID from CMOBJECTS);
  193. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  194. select cast(1 as integer),'CMOBJPROPS73', CMID from CMOBJPROPS73 where CMID not in (select CMID from CMOBJECTS);
  195. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  196. select cast(1 as integer),'CMOBJPROPS74', CMID from CMOBJPROPS74 where CMID not in (select CMID from CMOBJECTS);
  197. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  198. select cast(1 as integer),'CMOBJPROPS75', CMID from CMOBJPROPS75 where CMID not in (select CMID from CMOBJECTS);
  199. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  200. select cast(1 as integer),'CMOBJPROPS76', CMID from CMOBJPROPS76 where CMID not in (select CMID from CMOBJECTS);
  201. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  202. select cast(1 as integer),'CMOBJPROPS77', CMID from CMOBJPROPS77 where CMID not in (select CMID from CMOBJECTS);
  203. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  204. select cast(1 as integer),'CMOBJPROPS78', CMID from CMOBJPROPS78 where CMID not in (select CMID from CMOBJECTS);
  205. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  206. select cast(1 as integer),'CMOBJPROPS79', CMID from CMOBJPROPS79 where CMID not in (select CMID from CMOBJECTS);
  207. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  208. select cast(1 as integer),'CMREFORD2', CMID from CMREFORD2 where CMID not in (select CMID from CMOBJECTS);
  209. -- 6.0 tables
  210. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  211. select cast(1 as integer),'CMOBJPROPS80', CMID from CMOBJPROPS80 where CMID not in (select CMID from CMOBJECTS);
  212. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  213. select cast(1 as integer),'CMARCHIVESTATUS', CMID from CMARCHIVESTATUS where CMID not in (select CMID from CMOBJECTS);
  214. -- 7.0 tables
  215. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  216. select cast(1 as integer),'CMOBJPROPS81', CMID from CMOBJPROPS81 where CMID not in (select CMID from CMOBJECTS);
  217. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  218. select cast(1 as integer),'CMOBJPROPS82', CMID from CMOBJPROPS82 where CMID not in (select CMID from CMOBJECTS);
  219. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  220. select cast(1 as integer),'CMOBJPROPS83', CMID from CMOBJPROPS83 where CMID not in (select CMID from CMOBJECTS);
  221. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  222. select cast(1 as integer),'CMOBJPROPS84', CMID from CMOBJPROPS84 where CMID not in (select CMID from CMOBJECTS);
  223. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  224. select cast(1 as integer),'CMOBJPROPS85', CMID from CMOBJPROPS85 where CMID not in (select CMID from CMOBJECTS);
  225. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  226. select cast(1 as integer),'CMOBJPROPS86', CMID from CMOBJPROPS86 where CMID not in (select CMID from CMOBJECTS);
  227. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  228. select cast(1 as integer),'CMOBJPROPS87', CMID from CMOBJPROPS87 where CMID not in (select CMID from CMOBJECTS);
  229. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  230. select cast(1 as integer),'CMOBJPROPS88', CMID from CMOBJPROPS88 where CMID not in (select CMID from CMOBJECTS);
  231. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  232. select cast(1 as integer),'CMOBJPROPS89', CMID from CMOBJPROPS89 where CMID not in (select CMID from CMOBJECTS);
  233. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  234. select cast(1 as integer),'CMOBJPROPS90', CMID from CMOBJPROPS90 where CMID not in (select CMID from CMOBJECTS);
  235. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  236. select cast(1 as integer),'CMOBJPROPS91', CMID from CMOBJPROPS91 where CMID not in (select CMID from CMOBJECTS);
  237. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  238. select cast(1 as integer),'CMOBJPROPS92', CMID from CMOBJPROPS92 where CMID not in (select CMID from CMOBJECTS);
  239. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  240. select cast(1 as integer),'CMOBJPROPS93', CMID from CMOBJPROPS93 where CMID not in (select CMID from CMOBJECTS);
  241. insert into SESSION.CMCHECKCONSISTENCY(inconsistency, description, CMID)
  242. select cast(1 as integer),'CMTAGS', CMID from CMTAGS where CMID not in (select CMID from CMOBJECTS);
  243. --CMSCRIPT_SKIP_COMMAND
  244. --#COMMENT
  245. --#COMMENT CMIDs not in CMOBJECTS table
  246. select description, CMID from SESSION.CMCHECKCONSISTENCY where inconsistency = 1 order by 1,2;
  247. --CMSCRIPT_SKIP_COMMAND
  248. --#COMMENT
  249. --#COMMENT CMIDs in CMOBJECTS table but not in CMOBJNAMES or CMPOLICIES tables
  250. select description, CMID from SESSION.CMCHECKCONSISTENCY where inconsistency = 2 order by 1,2;
  251. --CMSCRIPT_SKIP_COMMAND
  252. --#COMMENT
  253. --#COMMENT CMIDs in CMSTOREIDS table where STOREID is null
  254. select description, CMID from SESSION.CMCHECKCONSISTENCY where inconsistency = 3 order by 1,2;
  255. --CMSCRIPT_SKIP_COMMAND
  256. --#COMMENT
  257. --#COMMENT CMIDs in CMSTOREIDS table which have duplicate STOREIDs
  258. select description, CMID from SESSION.CMCHECKCONSISTENCY where inconsistency = 4 order by 1,2;