{"id":1932,"date":"2023-01-29T16:30:06","date_gmt":"2023-01-29T16:30:06","guid":{"rendered":"https:\/\/flace.de\/?p=1932"},"modified":"2024-03-05T18:45:38","modified_gmt":"2024-03-05T18:45:38","slug":"sql-fuellen-einer-zeiterfassung-mit-kostentraegern","status":"publish","type":"post","link":"https:\/\/flace.de\/?p=1932","title":{"rendered":"SQL zykl. F\u00fcllen einer Tabelle f\u00fcr externe Zeiterfassung mit Kostentr\u00e4gern"},"content":{"rendered":"\n<p class=\"has-vivid-cyan-blue-color has-text-color\"><strong>1. Teil eine View mit den aktiven Kostentr\u00e4gern erzeugen<\/strong><\/p>\n\n\n\n<p>create view [dbo].[v_kostentraeger] as<br>select ProjNr,rechadr, AuftragStatus, AAuftragStatus, BAuftragStatus, left(ProjBezeichnung,20)as Projbez,AbtNr, Auftragsdatum, CONVERT(varchar(MAX), AuftragsDatum, 104)as Adatum from projekt<br>where AuftragStatus=7 or AuftragStatus=8 and Kategorie is NULL and (left(Projnr,1)=&#8217;1&#8242; or left(Projnr,1)=&#8217;2&#8242;)<br>union<br>select ProjNr,rechadr, Auftragstatus, AAuftragStatus, BAuftragStatus, left(ProjBezeichnung,20),abtnr, createdate, CONVERT(varchar(MAX), Createdate, 104) from regie<br>where (AuftragStatus=0 and AAuftragStatus=5) or (AuftragStatus=0 and AAuftragStatus=0) and Kategorie is NULL<\/p>\n\n\n\n<p class=\"has-vivid-cyan-blue-color has-text-color\"><strong>2. SQL Job f\u00fcllt in Intervallen die Tabelle ZZ_Timeninfo mit aktiven Kostentr\u00e4gern<\/strong><\/p>\n\n\n\n<p>INSERT INTO ZZ_Timeinfo<br>(ProjNr ,Projbez ,rechadr ,erzeugt)<br>select projnr, projbez, rechadr,Getdate() from v_kostentraeger<br>where projnr not in (select projnr from zz_timeinfo)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. Teil eine View mit den aktiven Kostentr\u00e4gern erzeugen create view [dbo].[v_kostentraeger] asselect ProjNr,rechadr, AuftragStatus, AAuftragStatus, BAuftragStatus, left(ProjBezeichnung,20)as Projbez,AbtNr, Auftragsdatum, CONVERT(varchar(MAX), AuftragsDatum, 104)as Adatum from projektwhere AuftragStatus=7 or AuftragStatus=8 and Kategorie is NULL and (left(Projnr,1)=&#8217;1&#8242; or left(Projnr,1)=&#8217;2&#8242;)unionselect ProjNr,rechadr, Auftragstatus, AAuftragStatus, BAuftragStatus, left(ProjBezeichnung,20),abtnr, createdate, CONVERT(varchar(MAX), Createdate, 104) from regiewhere (AuftragStatus=0 and AAuftragStatus=5) or (AuftragStatus=0 and AAuftragStatus=0) &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/flace.de\/?p=1932\" class=\"more-link\"><span class=\"screen-reader-text\">\u201eSQL zykl. F\u00fcllen einer Tabelle f\u00fcr externe Zeiterfassung mit Kostentr\u00e4gern\u201c<\/span> weiterlesen<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,45],"tags":[],"class_list":["post-1932","post","type-post","status-publish","format-standard","hentry","category-sql","category-stundenerfassung"],"_links":{"self":[{"href":"https:\/\/flace.de\/index.php?rest_route=\/wp\/v2\/posts\/1932","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/flace.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/flace.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/flace.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/flace.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1932"}],"version-history":[{"count":2,"href":"https:\/\/flace.de\/index.php?rest_route=\/wp\/v2\/posts\/1932\/revisions"}],"predecessor-version":[{"id":1935,"href":"https:\/\/flace.de\/index.php?rest_route=\/wp\/v2\/posts\/1932\/revisions\/1935"}],"wp:attachment":[{"href":"https:\/\/flace.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1932"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/flace.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1932"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/flace.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1932"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}