{"id":43,"date":"2013-08-20T11:50:22","date_gmt":"2013-08-20T10:50:22","guid":{"rendered":"http:\/\/sourceblog.org\/wordpress\/?p=43"},"modified":"2013-08-22T10:17:57","modified_gmt":"2013-08-22T09:17:57","slug":"automatisierung-von-sql-scripten","status":"publish","type":"post","link":"https:\/\/sourceblog.org\/wordpress\/2013\/08\/automatisierung-von-sql-scripten\/","title":{"rendered":"Automatisierung von SQL Scripten"},"content":{"rendered":"<p>In manchen F\u00e4llen ist es wichtig SQL Scripte automatisch auszuf\u00fchren. Das kann ganz einfach mittels einer kleinen Batch Datei und der Windows Aufgabenplanung erfolgen. Hierzu sind folgen Schritte notwendig:<\/p>\n<p>Schritt 1:<\/p>\n<p style=\"padding-left: 30px;\">Man legt unter einem frei w\u00e4hlbaren Pfad zwei Ordner an &#8222;scripts&#8220; und &#8222;logs&#8220;. Au\u00dferdem erstellt man eine Batch Datei. (Bild)<\/p>\n<div id=\"attachment_60\" style=\"width: 310px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/sourceblog.org\/wordpress\/wp-content\/uploads\/2013\/08\/autosql11.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-60\" class=\"size-medium wp-image-60\" title=\"Exploreransicht\" alt=\"Exploreransicht\" src=\"https:\/\/sourceblog.org\/wordpress\/wp-content\/uploads\/2013\/08\/autosql11-300x42.png\" width=\"300\" height=\"42\" srcset=\"https:\/\/sourceblog.org\/wordpress\/wp-content\/uploads\/2013\/08\/autosql11-300x42.png 300w, https:\/\/sourceblog.org\/wordpress\/wp-content\/uploads\/2013\/08\/autosql11.png 600w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-60\" class=\"wp-caption-text\">Exploreransicht der Batchdateien<\/p><\/div>\n<p>Schritt 2:<\/p>\n<p style=\"padding-left: 30px;\">Im Ordner &#8222;scripts&#8220; legt man nun die entsprechenden SQL Script Dateien ab. (Bild)<\/p>\n<div id=\"attachment_61\" style=\"width: 310px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/sourceblog.org\/wordpress\/wp-content\/uploads\/2013\/08\/autosql21.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-61\" class=\"size-medium wp-image-61\" title=\"Script Dateien\" alt=\"Exploereransicht der Script Dateien\" src=\"https:\/\/sourceblog.org\/wordpress\/wp-content\/uploads\/2013\/08\/autosql21-300x25.png\" width=\"300\" height=\"25\" srcset=\"https:\/\/sourceblog.org\/wordpress\/wp-content\/uploads\/2013\/08\/autosql21-300x25.png 300w, https:\/\/sourceblog.org\/wordpress\/wp-content\/uploads\/2013\/08\/autosql21.png 599w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-61\" class=\"wp-caption-text\">Exploereransicht der Script Dateien<\/p><\/div>\n<p>Schritt 3:<\/p>\n<p style=\"padding-left: 30px;\">Als n\u00e4chstes \u00e4ndert man die Batch Datei und f\u00fcgt nachfolgende Befehle ein.<\/p>\n<address style=\"padding-left: 60px;\">@echo off<br \/>\nsetlocal ENABLEDELAYEDEXPANSION<br \/>\nsqlcmd -i scripts\\Datei1.sql -o logs\\Datei1.log<br \/>\nsqlcmd -i scripts\\Datei2.sql -o logs\\Datei2.log<br \/>\nendlocal<\/address>\n<address style=\"padding-left: 60px;\">\u00a0<\/address>\n<p>Schritt 4:<\/p>\n<p style=\"padding-left: 30px;\">Als Abschluss nimmt man die Batch Datei in die Windows Aufgabenplanung. Hierbei ist zu beachten, dass ein Nutzer gew\u00e4hlt wird, welcher zum Ausf\u00fchren der Scripte berechtigt ist.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In manchen F\u00e4llen ist es wichtig SQL Scripte automatisch auszuf\u00fchren. Das kann ganz einfach mittels einer kleinen Batch Datei und der Windows Aufgabenplanung erfolgen. Hierzu sind folgen Schritte notwendig: Schritt 1: Man legt unter einem frei w\u00e4hlbaren Pfad zwei Ordner &hellip; <a href=\"https:\/\/sourceblog.org\/wordpress\/2013\/08\/automatisierung-von-sql-scripten\/\">Weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[3,37],"tags":[17,16],"class_list":["post-43","post","type-post","status-publish","format-standard","hentry","category-sp","category-sql","tag-aufgabenplanung","tag-automatisch-sql-sharepoint-script"],"_links":{"self":[{"href":"https:\/\/sourceblog.org\/wordpress\/wp-json\/wp\/v2\/posts\/43","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sourceblog.org\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sourceblog.org\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sourceblog.org\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sourceblog.org\/wordpress\/wp-json\/wp\/v2\/comments?post=43"}],"version-history":[{"count":9,"href":"https:\/\/sourceblog.org\/wordpress\/wp-json\/wp\/v2\/posts\/43\/revisions"}],"predecessor-version":[{"id":80,"href":"https:\/\/sourceblog.org\/wordpress\/wp-json\/wp\/v2\/posts\/43\/revisions\/80"}],"wp:attachment":[{"href":"https:\/\/sourceblog.org\/wordpress\/wp-json\/wp\/v2\/media?parent=43"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sourceblog.org\/wordpress\/wp-json\/wp\/v2\/categories?post=43"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sourceblog.org\/wordpress\/wp-json\/wp\/v2\/tags?post=43"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}