{"id":419,"date":"2009-08-18T03:19:24","date_gmt":"2009-08-17T21:19:24","guid":{"rendered":"http:\/\/techsatwork.com\/blog\/?p=419"},"modified":"2016-01-07T11:31:11","modified_gmt":"2016-01-07T05:31:11","slug":"dont-get-caught-in-check-pending","status":"publish","type":"post","link":"https:\/\/techsatwork.com\/?p=419","title":{"rendered":"Don&#8217;t get caught in check pending"},"content":{"rendered":"<p>If your database is like mine and you might get have load request that does not come in the right order of foreign key relationship you can get into check pending fiasco.\u00c2\u00a0 There might be parents, children, grandchildren and so on, it can become a tiny difficult to create the scripts. Here is an sql I created that helped me generate the SET INTEGRITY sql to get the tables checked :<\/p>\n<p><span style=\"color: #3366ff;\">with gen(tabname, seq) as( select rtrim(tabschema) || &#8216;.&#8217; || rtrim(tabname)<br \/>\nas tabname, row_number() over (partition by status) as seq<br \/>\nfrom\u00c2\u00a0 syscat.tables<br \/>\nWHERE status=&#8217;C&#8217; ),r(a, seq1) as (select CAST(tabname as VARCHAR(3900)), seq<br \/>\nfrom\u00c2\u00a0 gen where seq=1 union all select r.a || &#8216;,&#8217;|| rtrim(gen.tabname), gen.seq<br \/>\nfrom gen , r where (r.seq1+1)=gen.seq ), r1 as (select a, seq1 from r)<br \/>\nselect &#8216;SET INTEGRITY FOR &#8216; || a || &#8216; IMMEDIATE CHECKED;&#8217; from r1<br \/>\nwhere seq1=(select max(seq1) from r1);<\/span><\/p>\n<p>This will generate the sqls that can be saved to a file and then run , you may have to run it couple of times to clear all of them.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If your database is like mine and you might get have load request that does not come in the right order of foreign key relationship you can get into check pending fiasco.\u00c2\u00a0 There might be parents, children, grandchildren and so on, it can become a tiny difficult to create the scripts. Here is an sql [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-container-style":"default","site-container-layout":"default","site-sidebar-layout":"default","site-transparent-header":"default","disable-article-header":"default","disable-site-header":"default","disable-site-footer":"default","disable-content-area-spacing":"default","footnotes":""},"categories":[3],"tags":[252,943,253],"class_list":["post-419","post","type-post","status-publish","format-standard","hentry","category-db2","tag-check-pending","tag-db2","tag-set-integrity"],"_links":{"self":[{"href":"https:\/\/techsatwork.com\/index.php?rest_route=\/wp\/v2\/posts\/419","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techsatwork.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techsatwork.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techsatwork.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techsatwork.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=419"}],"version-history":[{"count":2,"href":"https:\/\/techsatwork.com\/index.php?rest_route=\/wp\/v2\/posts\/419\/revisions"}],"predecessor-version":[{"id":421,"href":"https:\/\/techsatwork.com\/index.php?rest_route=\/wp\/v2\/posts\/419\/revisions\/421"}],"wp:attachment":[{"href":"https:\/\/techsatwork.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=419"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techsatwork.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=419"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techsatwork.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=419"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}