{"id":6529,"date":"2018-04-16T12:54:12","date_gmt":"2018-04-16T11:54:12","guid":{"rendered":"http:\/\/help.sdna.lu\/?p=6529&#038;lang=en"},"modified":"2022-12-18T11:11:51","modified_gmt":"2022-12-18T10:11:51","slug":"query-to-delete-unused-security-records","status":"publish","type":"post","link":"https:\/\/sdna.lu\/?p=6529","title":{"rendered":"Query to delete unused Security records"},"content":{"rendered":"<p>Use this query to delete unused Security records:<\/p>\n<p><code>Delete from [Article] where convert(varchar, [Article].[DBId]) + '-' + convert(varchar, [Article].[Id]) in<br \/>\n(Select convert(varchar, [Article].[DBId]) + '-' + convert(varchar, [Article].[Id]) from [Article] LEFT JOIN [StockTransfer]<br \/>\nON ([Article].[Id] = [StockTransfer].[ArticleId] and [Article].[DBId] =[StockTransfer].DBId])<br \/>\nwhere [StockTransfer].[ArticleId] Is Null and Not [Article].[DBId] = 0)<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Use this query to delete unused Security records: Delete from [Article] where convert(varchar, [Article].[DBId]) + &#8216;-&#8216; + convert(varchar, [Article].[Id]) in (Select convert(varchar, [Article].[DBId]) + &#8216;-&#8216; + convert(varchar, [Article].[Id]) from [Article] LEFT JOIN [StockTransfer] ON ([Article].[Id] = [StockTransfer].[ArticleId] and [Article].[DBId] =[StockTransfer].DBId]) where [StockTransfer].[ArticleId] Is Null and Not [Article].[DBId] = 0)<\/p>\n","protected":false},"author":19,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[487],"tags":[],"class_list":["post-6529","post","type-post","status-publish","format-standard","hentry","category-query"],"_links":{"self":[{"href":"https:\/\/sdna.lu\/index.php?rest_route=\/wp\/v2\/posts\/6529","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sdna.lu\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sdna.lu\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sdna.lu\/index.php?rest_route=\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/sdna.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6529"}],"version-history":[{"count":1,"href":"https:\/\/sdna.lu\/index.php?rest_route=\/wp\/v2\/posts\/6529\/revisions"}],"predecessor-version":[{"id":6530,"href":"https:\/\/sdna.lu\/index.php?rest_route=\/wp\/v2\/posts\/6529\/revisions\/6530"}],"wp:attachment":[{"href":"https:\/\/sdna.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6529"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sdna.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6529"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sdna.lu\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6529"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}