<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Datenbanken Archive - Pixelfriedhof</title>
	<atom:link href="https://pixelfriedhof.com/tag/datenbanken/feed/" rel="self" type="application/rss+xml" />
	<link>https://pixelfriedhof.com/tag/datenbanken/</link>
	<description>IT-Blog, Fotoblog, Travelblog, Nerdstuff</description>
	<lastBuildDate>Wed, 29 Jan 2020 20:20:24 +0000</lastBuildDate>
	<language>de</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.3</generator>

<image>
	<url>https://pixelfriedhof.com/wp-content/uploads/2022/02/cropped-My-project-3-32x32.png</url>
	<title>Datenbanken Archive - Pixelfriedhof</title>
	<link>https://pixelfriedhof.com/tag/datenbanken/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Videoreihe &#8222;MS SQL-Server für blutige Anfänger&#8220;</title>
		<link>https://pixelfriedhof.com/videoreihe-ms-sql-server-fuer-blutige-anfaenger/</link>
					<comments>https://pixelfriedhof.com/videoreihe-ms-sql-server-fuer-blutige-anfaenger/#respond</comments>
		
		<dc:creator><![CDATA[megaadmin]]></dc:creator>
		<pubDate>Sun, 06 Dec 2015 11:06:06 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Datenbanken]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL-Server]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">http://pixelfriedhof.com/?p=105</guid>

					<description><![CDATA[<p>Ihre Daten werden erst beim Abspielen des Youtube-Videos an den Dienst übermittelt. Your data will</p>
<p>Der Beitrag <a href="https://pixelfriedhof.com/videoreihe-ms-sql-server-fuer-blutige-anfaenger/">Videoreihe &#8222;MS SQL-Server für blutige Anfänger&#8220;</a> erschien zuerst auf <a href="https://pixelfriedhof.com">Pixelfriedhof</a>.</p>
]]></description>
										<content:encoded><![CDATA[<a href="https://pixelfriedhof.com/videoreihe-ms-sql-server-fuer-blutige-anfaenger/"><img decoding="async" src="https://pixelfriedhof.com/wp-content/plugins/wp-youtube-lyte/lyteCache.php?origThumbUrl=%2F%2Fi.ytimg.com%2Fvi%2FPLcnT0JqQtWqOJsQE_ox3RdbZDuLUpLE7j%2Fhqdefault.jpg" alt="YouTube Video"></a><br />Ihre Daten werden erst beim Abspielen des Youtube-Videos an den Dienst übermittelt. Your data will only be transmitted to the service when you play the Youtube video.<br /></p>
<p>Der Beitrag <a href="https://pixelfriedhof.com/videoreihe-ms-sql-server-fuer-blutige-anfaenger/">Videoreihe &#8222;MS SQL-Server für blutige Anfänger&#8220;</a> erschien zuerst auf <a href="https://pixelfriedhof.com">Pixelfriedhof</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://pixelfriedhof.com/videoreihe-ms-sql-server-fuer-blutige-anfaenger/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Alle Connections zu einer SQL-Datenbank trennen</title>
		<link>https://pixelfriedhof.com/alle-connections-zu-einer-sql-datenbank-trennen/</link>
					<comments>https://pixelfriedhof.com/alle-connections-zu-einer-sql-datenbank-trennen/#respond</comments>
		
		<dc:creator><![CDATA[megaadmin]]></dc:creator>
		<pubDate>Mon, 27 Jul 2015 19:07:07 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Datenbanken]]></category>
		<category><![CDATA[SQL-Server]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">http://pixelfriedhof.com/?p=84</guid>

					<description><![CDATA[<p>Manchmal gibt es Situationen, da ist eine Datenbank so „vor die Wand gefahren“, dass der Zugriff durch ein simples „ALTER DATABASE … ROLLBACK IMMEDIATE“ nicht wieder hergestellt werden kann.</p>
<p>Das kann zum Beispiel passieren, wenn ein fehlerhafter Restore-Prozess gestartet wird. So im Falle meines Kunden geschehen. Restore über die MSSQLSMS-GUI gestartet, Medium ausgewählt, LDF und MDF-Datei ausgetauscht, aber das Ziel vergessen. Endeffekt beim SQL-Server 2008: Ziel- und Quelldaten(banken) komplett gesperrt und eine riesige Menge offener Transaktionen, die sich nicht beenden lassen. Es gibt aber noch Hoffnung:</p>
<p>Der Beitrag <a href="https://pixelfriedhof.com/alle-connections-zu-einer-sql-datenbank-trennen/">Alle Connections zu einer SQL-Datenbank trennen</a> erschien zuerst auf <a href="https://pixelfriedhof.com">Pixelfriedhof</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Manchmal gibt es Situationen, da ist eine Datenbank so „vor die Wand gefahren“, dass der Zugriff durch ein simples „ALTER DATABASE … ROLLBACK IMMEDIATE“ nicht wieder hergestellt werden kann.</p>
<p>Das kann zum Beispiel passieren, wenn ein fehlerhafter Restore-Prozess gestartet wird. So im Falle meines Kunden geschehen. Restore über die MSSQLSMS-GUI gestartet, Medium ausgewählt, LDF und MDF-Datei ausgetauscht, aber das Ziel vergessen. Endeffekt beim SQL-Server 2008: Ziel- und Quelldaten(banken) komplett gesperrt und eine riesige Menge offener Transaktionen, die sich nicht beenden lassen. Es gibt aber noch Hoffnung:</p>
<p>&nbsp;</p>
<p>Folgendes Script killt alle Transaktionen zu einer bestimmten Datenbank.</p>
<p>Bitte ‚DB_NAME‘ gegen den tatsächlichen Namen der gesperrten Datenbank austauschen und abfeuern.</p>
<p style="background: #eeeeee;"><span style="font-size: 10pt; font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">USE</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;"> master</span></p>
<p style="background: #eeeeee;"><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">GO</span></p>
<p style="background: #eeeeee;"><span style="font-size: 10pt; font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">SET</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;"> NOCOUNT </span><span style="font-size: 10pt; font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">ON</span></p>
<p style="background: #eeeeee;"><span style="font-size: 10pt; font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">DECLARE</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;"> @DBName varchar(</span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">50</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">)</span></p>
<p style="background: #eeeeee;"><span style="font-size: 10pt; font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">DECLARE</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;"> @spidstr varchar(</span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">8000</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">)</span></p>
<p style="background: #eeeeee;"><span style="font-size: 10pt; font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">DECLARE</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;"> @ConnKilled smallint</span></p>
<p style="background: #eeeeee;"><span style="font-size: 10pt; font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">SET</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;"> @ConnKilled=</span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">0</span></p>
<p style="background: #eeeeee;"><span style="font-size: 10pt; font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">SET</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;"> @spidstr = </span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">&#8220;</span></p>
<p style="background: #eeeeee;"><span style="font-size: 10pt; font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">Set</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;"> @DBName = </span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">&#8218;DB_NAME&#8216;</span></p>
<p style="background: #eeeeee;"><span style="font-size: 10pt; font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">IF</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;"> db_id(@DBName) &lt; </span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">4</span></p>
<p style="background: #eeeeee;"><span style="font-size: 10pt; font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">BEGIN</span></p>
<p style="background: #eeeeee;"><span style="font-size: 10pt; font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">PRINT</span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">&#8218;Connections to system databases cannot be killed&#8216;</span></p>
<p style="background: #eeeeee;"><span style="font-size: 10pt; font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">RETURN</span></p>
<p style="background: #eeeeee;"><span style="font-size: 10pt; font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">END</span></p>
<p style="background: #eeeeee;"><span style="font-size: 10pt; font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">SELECT</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;"> @spidstr=</span><span style="font-size: 10pt; font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">coalesce</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">(@spidstr,</span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">&#8218;,&#8216;</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;"> )+</span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">&#8218;kill &#8218;</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">+</span><span style="font-size: 10pt; font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">convert</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">(varchar, spid)+ </span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">&#8218;; &#8218;</span></p>
<p style="background: #eeeeee;"><span style="font-size: 10pt; font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">FROM</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;"> master..sysprocesses </span><span style="font-size: 10pt; font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">WHERE</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;"> dbid=db_id(@DBName)</span></p>
<p style="background: #eeeeee;"><span style="font-size: 10pt; font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">IF</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;"> LEN(@spidstr) &gt; </span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">0</span></p>
<p style="background: #eeeeee;"><span style="font-size: 10pt; font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">BEGIN</span></p>
<p style="background: #eeeeee;"><span style="font-size: 10pt; font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">EXEC</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">(@spidstr)</span></p>
<p style="background: #eeeeee;"><span style="font-size: 10pt; font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">SELECT</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;"> @ConnKilled = COUNT(</span><span style="font-size: 10pt; font-family: Consolas; color: maroon; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">1</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">)</span></p>
<p style="background: #eeeeee;"><span style="font-size: 10pt; font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">FROM</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;"> master..sysprocesses </span><span style="font-size: 10pt; font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">WHERE</span><span style="font-size: 10pt; font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;"> dbid=db_id(@DBName)</span></p>
<p style="background: #eeeeee;"><span style="font-size: 10pt; font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">END</span></p>
<p>Im Anschluss daran funktioniert ein ggf. vorher nicht erfolgreiches</p>
<pre style="background: #eeeeee;"><span class="kwd"><span style="font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">ALTER</span></span><span class="pln"></span><span class="kwd"><span style="font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">DATABASE</span></span><span class="pln"><span style="font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;"> DB_NAME</span></span></pre>
<pre style="background: #eeeeee;"><span class="kwd"><span style="font-family: Consolas; color: #00008b; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">SET</span></span><span class="pln"><span style="font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;"> MULTI_USER</span></span><span class="pun"><span style="font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">;</span></span></pre>
<pre style="background: #eeeeee;"><span class="pln"><span style="font-family: Consolas; border: 1pt none windowtext; padding: 0cm; background-image: initial; background-attachment: initial; background-position: initial; background-repeat: initial;">GO</span></span></pre>
<p>wieder.</p>
<p>Der Beitrag <a href="https://pixelfriedhof.com/alle-connections-zu-einer-sql-datenbank-trennen/">Alle Connections zu einer SQL-Datenbank trennen</a> erschien zuerst auf <a href="https://pixelfriedhof.com">Pixelfriedhof</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://pixelfriedhof.com/alle-connections-zu-einer-sql-datenbank-trennen/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Inhalte einer CSV-Datei per SQL in bestehende Tabelle importieren (Bulk Operation)</title>
		<link>https://pixelfriedhof.com/inhalte-einer-csv-datei-per-sql-in-bestehende-tabelle-importieren-bulk-operation/</link>
					<comments>https://pixelfriedhof.com/inhalte-einer-csv-datei-per-sql-in-bestehende-tabelle-importieren-bulk-operation/#respond</comments>
		
		<dc:creator><![CDATA[megaadmin]]></dc:creator>
		<pubDate>Tue, 30 Jun 2015 19:31:00 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Datenbanken]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">http://pixelfriedhof.com/?p=81</guid>

					<description><![CDATA[<p>Script zum Import von Daten aus einer CSV Datei in eine bereits bestehende MS-SQL-Tabelle per Bulk-Operation. Erstellung einer temporären Tabelle, Einlesen, Übernahme in Produktivtabelle. Die Zuordnung der Daten zu den richtigen Schlüssel erfolgt über einen Inner-Join.</p>
<p> </p>
<p>Der Beitrag <a href="https://pixelfriedhof.com/inhalte-einer-csv-datei-per-sql-in-bestehende-tabelle-importieren-bulk-operation/">Inhalte einer CSV-Datei per SQL in bestehende Tabelle importieren (Bulk Operation)</a> erschien zuerst auf <a href="https://pixelfriedhof.com">Pixelfriedhof</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Script zum Import von Daten aus einer CSV Datei in eine bereits bestehende MS-SQL-Tabelle per Bulk-Operation. Erstellung einer temporären Tabelle, Einlesen, Übernahme in Produktivtabelle. Die Zuordnung der Daten zu den richtigen Schlüssel erfolgt über einen Inner-Join.</p>
<p> </p>
<p> </p>
<p> </p>
<p>Wichtig hierbei ist lediglich zu beachten, dass der durchführende Datenbankbenutzer das Recht für &#8222;Bulk-Operations&#8220; hat.</p>
<p> </p>
<p >Keine Produkte gefunden.</p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; color: #0433ff;"> </p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; color: #0433ff;"> </p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; color: #0433ff; text-align: left;">CREATE TABLE <span style="color: #009193;">TEMP</span> <span style="color: #929292;">(</span></p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; color: #009193; text-align: left;"><span style="color: #000000;">  </span>[personalnr] <span style="color: #0433ff;">varchar</span><span style="color: #929292;">(</span><span style="color: #000000;">15</span><span style="color: #929292;">),</span></p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; color: #009193; text-align: left;"><span style="color: #000000;">  </span>[Emailadresse] <span style="color: #0433ff;">varchar</span><span style="color: #929292;">(</span><span style="color: #000000;">200</span><span style="color: #929292;">),</span></p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; color: #0433ff; text-align: left;"><span style="color: #000000;">  </span><span style="color: #009193;">[Ort] </span>varchar<span style="color: #929292;">(</span><span style="color: #000000;">40</span><span style="color: #929292;">)</span></p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; color: #008f00; text-align: left;">&#8212; Hier erstellen wir eine Temporäre Tabelle um die Daten der CSV-Datei erstmals anzunehmen und zwischenzulagern.</p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; color: #008f00; text-align: left;">&#8212; Die Reihenfolge der Spaltennamen muss auch in der CSV-Datei eingehalten werden.</p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; color: #929292; text-align: left;">)</p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; color: #0433ff; text-align: left;">GO</p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; color: #008f00; text-align: left;"><span style="color: #0433ff;">BULK </span><span style="color: #0433ff;">INSERT </span><span style="color: #009193;">TEMP</span>&#8212; Temporäre Tabelle mit CSV-Daten füllen</p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; color: #008f00; text-align: left;"><span style="color: #0433ff;">FROM </span><span style="color: #ff2600;">&#8218;J:\WORK\import\mail.csv&#8216;</span>&#8212; Dies ist der Pfad zu der Datei die importiert wird. WICHTIG: Der Pfad bezieht sich auf den Pfad im Server, nicht auf den Rechner auf dem das Managementstudio ausgeführt wird.</p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; color: #0433ff; text-align: left;">WITH</p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; color: #0433ff; text-align: left;"> <span style="color: #929292;">(</span></p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; color: #008f00; text-align: left;"><span style="color: #000000;">    </span><span style="color: #0433ff;">FIELDTERMINATOR</span><span style="color: #929292;">=</span><span style="color: #ff2600;">&#8218;,&#8216;</span><span style="color: #929292;">,</span><span style="color: #000000;">    </span>&#8212; Darauf achten, dass die CSV-Datei wirklich die Spalten mit Komma und nicht mit Semikolon separiert</p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; color: #008f00; text-align: left;"><span style="color: #000000;">    </span><span style="color: #0433ff;">rowterminator</span><span style="color: #929292;">=</span><span style="color: #ff2600;">&#8218;\n&#8216;</span><span style="color: #000000;">     </span>&#8211;\n ist in den meisten Fällen korrekt, zumindest wenn die Datei aus einer deutschen Excel-Version als CSV erstellt wurde und ggf. nochmal mit dem Editor nachbearbeitet wurde.</p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; text-align: left;">  <span style="color: #929292;">)</span>    </p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; color: #0433ff; text-align: left;">GO</p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; color: #008f00; text-align: left;"><span style="color: #ff40ff;">UPDATE </span><span style="color: #009193;">mitarbeiter</span>&#8212; Inhalte der temporären Tabelle werden in die Produktivtabelle übernommen. Als Zuordnungsmerkmal fungiert die Personalnummer, welche wir in der temporären Tabelle &#8222;joinen&#8220;.</p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; color: #009193; text-align: left;"><span style="color: #0433ff;">SET </span>Emailadresse<span style="color: #929292;">=</span>temp<span style="color: #929292;">.</span>Emailadresse<span style="color: #929292;">,</span>Ort<span style="color: #929292;">=</span>temp<span style="color: #929292;">.</span>Ort</p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; color: #009193; text-align: left;"><span style="color: #0433ff;">FROM </span>mitarbeiter</p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; color: #929292; text-align: left;">INNERJOIN <span style="color: #009193;">temp</span></p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; color: #009193; text-align: left;"><span style="color: #0433ff;">ON </span>mitarbeiter<span style="color: #929292;">.</span>personalnr<span style="color: #929292;">=</span>temp<span style="color: #929292;">.</span>personalnr</p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; color: #0433ff; text-align: left;">GO</p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; color: #008f00; text-align: left;"><span style="color: #0433ff;">DROP </span><span style="color: #0433ff;">TABLE </span><span style="color: #009193;">TEMP</span><span style="color: #000000;">  </span>&#8212; Nach Abschluss aller vorherigen Vorgänge können wir die temporäre Tabelle löschen.</p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; color: #0433ff; text-align: left;">GO</p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; color: #0433ff; text-align: left;"> </p>
<p style="margin: 0px; font-size: 9.5px; font-family: Consolas; color: #0433ff; text-align: left;"> </p>
<p> </p>
<p> </p>
<p>All the links in this text are Amazon Affiliate Links, and by clicking on an affiliate link I will earn a percentage of your subsequent Amazon purchases. However, this circumstance does not influence the background of my product recommendation. This product recommendation is independent, honest and sincere.</p>
<p>Bei allen genannten Links handelt es sich um Amazon-Affiliate-Links. Durch einen Klick auf einen Affiliate-Link werde ich prozentual an Euren darauf folgenden Amazon-Einkäufen beteiligt. Dieser Umstand beeinflusst aber nicht die Hintergründe meiner Produktempfehlung. Diese Produktempfehlung erfolgt unabhängig, ehrlich und aufrichtig.</p>
<p>Der Beitrag <a href="https://pixelfriedhof.com/inhalte-einer-csv-datei-per-sql-in-bestehende-tabelle-importieren-bulk-operation/">Inhalte einer CSV-Datei per SQL in bestehende Tabelle importieren (Bulk Operation)</a> erschien zuerst auf <a href="https://pixelfriedhof.com">Pixelfriedhof</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://pixelfriedhof.com/inhalte-einer-csv-datei-per-sql-in-bestehende-tabelle-importieren-bulk-operation/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>SQL-Statements mit Excel erstellen (Quick and Dirty)</title>
		<link>https://pixelfriedhof.com/sql-statements-mit-excel-erstellen-quick-and-dirty/</link>
					<comments>https://pixelfriedhof.com/sql-statements-mit-excel-erstellen-quick-and-dirty/#respond</comments>
		
		<dc:creator><![CDATA[megaadmin]]></dc:creator>
		<pubDate>Tue, 30 Jun 2015 18:41:08 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Datenbanken]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">http://pixelfriedhof.com/?p=80</guid>

					<description><![CDATA[<p>Manchmal muss man vorgefertigte, als Liste angelieferte Daten, wie zum Beispiel Personalnummern, in eine Datenbank importieren und zeitgleich mit weiteren (Default-)Werten versehen. Jedes Statement händisch zu erstellen wäre durchaus aufwendig, gerade bei größeren Datenmengen. Die Funktion "Verketten" in Excel hilft da aber ungemein weiter.</p>
<p>&#160;</p>
<p>Der Beitrag <a href="https://pixelfriedhof.com/sql-statements-mit-excel-erstellen-quick-and-dirty/">SQL-Statements mit Excel erstellen (Quick and Dirty)</a> erschien zuerst auf <a href="https://pixelfriedhof.com">Pixelfriedhof</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Manchmal muss man vorgefertigte, als Liste angelieferte Daten, wie zum Beispiel Personalnummern, in eine Datenbank importieren und zeitgleich mit weiteren (Default-)Werten versehen. Jedes Statement händisch zu erstellen wäre durchaus aufwendig, gerade bei größeren Datenmengen. Die Funktion &#8222;Verketten&#8220; in Excel hilft da aber ungemein weiter.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Zuerst packen wir alle als Liste angelieferten Werte, in diesem vereinfachten Fall Personalnummern, untereinander in die Spalte.</p>
<p>In einer benachbarten Spalte fügen wir nun die Funktion &#8222;Verketten&#8220; zur Erstellung einer Zeichenfolge ein:</p>
<p>&nbsp;</p>
<p>=VERKETTEN(&#8222;<span style="color: #ff0000;">INSERT INTO personal VALUES(</span>&#8222;<span style="color: #3366ff;">;A3;</span>&#8222;<span style="color: #ff0000;">,Wert1,Wert2,&#8217;01.01.2015&#8242;,Porta Westfalica, NULL)</span>&#8222;)</p>
<p>&nbsp;</p>
<p>Dabei wird der rot geschriebene Text statisch übernommen und der blaue Baustein referenziert automatisch immer die vorstehende Spalte mit der Personalnummer.</p>
<p>Das Ergebnis sieht dann so aus und kann als Text-Kopie direkt ins SQL-Managementstudio importiert werden:</p>
<p>&nbsp;</p>
<p><img fetchpriority="high" decoding="async" src="https://pixelfriedhof.com/wp-content/images/computer/sql_statement_Erstellung.png" width="600" height="190" /></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Der Beitrag <a href="https://pixelfriedhof.com/sql-statements-mit-excel-erstellen-quick-and-dirty/">SQL-Statements mit Excel erstellen (Quick and Dirty)</a> erschien zuerst auf <a href="https://pixelfriedhof.com">Pixelfriedhof</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://pixelfriedhof.com/sql-statements-mit-excel-erstellen-quick-and-dirty/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>SQL-Server: LDF- und MDF-Datei &#8211; Unterschied und Zusammenhang</title>
		<link>https://pixelfriedhof.com/sql-server-ldf-und-mdf-datei-unterschied-und-zusammenhang/</link>
					<comments>https://pixelfriedhof.com/sql-server-ldf-und-mdf-datei-unterschied-und-zusammenhang/#respond</comments>
		
		<dc:creator><![CDATA[megaadmin]]></dc:creator>
		<pubDate>Sun, 19 Apr 2015 10:24:28 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Datenbanken]]></category>
		<category><![CDATA[SQL-Server]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">http://pixelfriedhof.com/?p=93</guid>

					<description><![CDATA[<p>Das Video erklärt den Unterschied und den Zusammenhang zwischen  den LDF- und MDF-Dateien einer Datenbank</p>
<p>Der Beitrag <a href="https://pixelfriedhof.com/sql-server-ldf-und-mdf-datei-unterschied-und-zusammenhang/">SQL-Server: LDF- und MDF-Datei &#8211; Unterschied und Zusammenhang</a> erschien zuerst auf <a href="https://pixelfriedhof.com">Pixelfriedhof</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Das Video erklärt den Unterschied und den Zusammenhang zwischen  den LDF- und MDF-Dateien einer Datenbank beim Microsoft SQL-Server.</p>
<a href="https://pixelfriedhof.com/sql-server-ldf-und-mdf-datei-unterschied-und-zusammenhang/"><img decoding="async" src="https://pixelfriedhof.com/wp-content/plugins/wp-youtube-lyte/lyteCache.php?origThumbUrl=%2F%2Fi.ytimg.com%2Fvi%2Ft8E2NGU4nMI%2Fhqdefault.jpg" alt="YouTube Video"></a><br />Ihre Daten werden erst beim Abspielen des Youtube-Videos an den Dienst übermittelt. Your data will only be transmitted to the service when you play the Youtube video.<br /></p>
<p>Der Beitrag <a href="https://pixelfriedhof.com/sql-server-ldf-und-mdf-datei-unterschied-und-zusammenhang/">SQL-Server: LDF- und MDF-Datei &#8211; Unterschied und Zusammenhang</a> erschien zuerst auf <a href="https://pixelfriedhof.com">Pixelfriedhof</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://pixelfriedhof.com/sql-server-ldf-und-mdf-datei-unterschied-und-zusammenhang/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Grundlegende SQL-Server-Performance sicherstellen</title>
		<link>https://pixelfriedhof.com/grundlegende-sql-server-performance-sicherstellen/</link>
					<comments>https://pixelfriedhof.com/grundlegende-sql-server-performance-sicherstellen/#respond</comments>
		
		<dc:creator><![CDATA[megaadmin]]></dc:creator>
		<pubDate>Mon, 02 Mar 2015 21:44:17 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Datenbanken]]></category>
		<category><![CDATA[SQL-Server]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">http://pixelfriedhof.com/?p=78</guid>

					<description><![CDATA[<p>Ein tiefgehendes SQL-Server-Tuning ist oftmals garnicht ohne ein entsprechendes Analyse-Audit m&#246;glich. Dennoch gibt es Basics, die erstmal erf&#252;llt sein m&#252;ssen, oder aber h&#228;ufig gern falsch gemacht werden. Hier eine kleine Zusammenfassung die ich immer mal wieder erweitern und erg&#228;nzen werde.</p>
<p>https://youtu.be/Ti3lu5NaGVs</p>
<p>Der Beitrag <a href="https://pixelfriedhof.com/grundlegende-sql-server-performance-sicherstellen/">Grundlegende SQL-Server-Performance sicherstellen</a> erschien zuerst auf <a href="https://pixelfriedhof.com">Pixelfriedhof</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Ein tiefgehendes SQL-Server-Tuning ist oftmals garnicht ohne ein entsprechendes Analyse-Audit möglich. Dennoch gibt es Basics, die erstmal erfüllt sein müssen, oder aber häufig gern falsch gemacht werden. Hier eine kleine Zusammenfassung die ich immer mal wieder erweitern und ergänzen werde.</p>
<a href="https://pixelfriedhof.com/grundlegende-sql-server-performance-sicherstellen/"><img decoding="async" src="https://pixelfriedhof.com/wp-content/plugins/wp-youtube-lyte/lyteCache.php?origThumbUrl=%2F%2Fi.ytimg.com%2Fvi%2FTi3lu5NaGVs%2Fhqdefault.jpg" alt="YouTube Video"></a><br />Ihre Daten werden erst beim Abspielen des Youtube-Videos an den Dienst übermittelt. Your data will only be transmitted to the service when you play the Youtube video.<br /></p>
<h3 style="margin: 5px 0px 10px; font-family: Verdana;"></h3>
<h3>LDF- und MDF-Datei auf unterschiedliche Laufwerke verteilen</h3>
<p>Es ist durchaus sinnvoll, die LDF- und die MDF-Dateien einer Datenbank auf verschiedene Laufwerke zu legen. Am besten auch auf Laufwerke abseits des eigentlichen Systemlaufwerks, unter dem z.B. das Betriebssystem arbeitet.</p>
<p>Jede Festplatte hat nur einen Schreibkopf, bzw. bei SSDs einen Controller. Ist der Schreibkopf, bzw. der Controller zum Beispiel gerade dabei die Logdatei (LDF) permanent fortzuschreiben, so muss er diesen Vorgang zum Auslesen der Datendatei (MDF) unterbrechen. Fortlaufende Logdateiinhalte müssen zwischengespeichert werden und dann bei Wiederaufnahme des Vorgangs auf die Platte gebracht werden. Das verzögert den ganzen Prozess ungemein und stellt gerade bei der Verwaltung von großen Datenmengen (meiner Definition nach MDF-Dateien &gt; 20GB) ein ernsthaftes Problem dar. Gleiches gilt allerdings auch, wenn mehrere MDF- oder LDF-Dateien unterschiedlicher Datenbanken auf ein und demselben physischen Laufwerk liegen.</p>
<p>Zudem ist das Verteilen der Daten im Falle eines Laufwerkschadens wesentlich sicherer. Ist die MDF-Datei beschädigt oder verloren, gibt es noch die LDF-Datei und umgekehrt.</p>
<p>Sie sollten die Datenbankdateien, egal ob MDF- oder LDF-Dateien, aus o.G. Gründen nach Möglichkeit auch auf einem anderen Laufwerk lagern, als das Serverbetriebssystem.</p>
<h3>Der SQL-Server gehört nicht auf einen Domaincontroller</h3>
<p>Auf der einen Seite geht es hier um Performance. Unglücklicher als Active Directory (AD)&nbsp; und SQL-Server kann man keine zwei Rollen und Dienste auf einem Windows-Server zusammenlegen. Beide Systeme ziehen Leistung und blockieren sich unter leicht zu erreichenden Bedingungen gegenseitig. Sie haben dann nicht nur ein Performanceproblem mit dem SQL-Server, sondern auch mit den AD-Funktionen. Wenn auch nicht sofort, aber irgendwann recht sich diese leichtsinnige Entscheidung: Entweder im laufenden Betrieb oder zu einem späteren Zeitpunkt, wenn Sie versuchen Einstellungen des SQL-Servers oder des ADs zu erweitern oder zu verändern.</p>
<p>In den neuesten Versionen des SQL-Servers bricht Microsoft die Installation des SQL-Servers ab, wenn es sich um einen Domaincontroller handelt. Sind Sie findig genug um diesen Mechanismus auszutricksen, nehmen Sie damit ernsthafte Probleme in Kauf.</p>
<p>Sie wollen, dass ich konkret werde? Die Funktion des schreibgeschützten ADs können Sie im Falle des gemeinsamen Hosts schon mal knicken. Genauso Fail-Over und Clustering beim SQL-Server. Sicherheitstechnisch ist der Betrieb eines SQL-Servers in unmittelbarer Nähe des Active Directory auch nicht schlau.</p>
<p>Außerdem gilt ganz besonders hier: Niemals alle Eier in einen Korb. Gerade weil es sich hier um die wirklich wichtigen Eier handelt. Die Haupt-Eier.</p>
<p>Tun Sie sich selbst einen Gefallen: Machen Sie das nicht.</p>
<h3></h3>
<h3>Der SQL-Server gehört nicht auf einen Server mit Terminaldiensten oder Citrix-Terminaldiensten</h3>
<p>Terminalservices oder Citrix-Terminaldienste sind Ressourcenfresser. Je nach gehosteter Anwendung kommen hier große Belastungen für CPU, Netzwerkhardware und Arbeitsspeicher zusammen. Sicherlich lassen sich große Teile dieser Problematiken mit der Aufstockung der Hardwarespezifikationen lösen, doch irgendwann ist auch an dieser Front Schluss mit Optimierungen. Tun Sie sich selbst einen Gefallen: Machen Sie das nicht.</p>
<h3></h3>
<h3>Keinen Bildschirmschoner und keinen Energiesparplan</h3>
<p>Man sollte meinen dieser Punkt wäre selbstverständlich. Nein, ist er anscheinend nicht. Fakt ist: Auf einem performanten SQL-Server-System haben diese Features nichts zu suchen. Gut gemeint, aber leider alles andere als hilfreich.</p>
<h3></h3>
<h3>Der VM-Netzwerk-Overkill</h3>
<p>Auch hier sollte man meinen, dass es sowas gar nicht gibt. Aber glauben Sie mir: Sowas gibt es im Produktiveinsatz.</p>
<p>Folgendes Szenario ist nicht sinnvoll: Ein physischer VM-Host beherbergt Domain Controller, Fileserver, Applikationsserver und natürlich SQL-Server als einzelne VMs. Ein anderer physischer Server im Netzwerk ist für das zeitgesteuerte Backup verantwortlich. Alle VMs des VM-Hosts laufen über eine Netzwerkkarte. Das funktioniert genau solange, bis das Backup anläuft. Die Netzwerkkarte glüht, laufende Applikationen geben den SQL-Server-Durchsatzraten den Rest.<br />
Wenn Sie sich mit Ihrer Virtualisierungsumgebung auskennen, analysieren Sie solche Flaschenhälse und beheben Sie sie durch die Zuordnung von Prioritäten oder neuer Netzwerkhardware.</p>
<p>Netzwerkflaschenhälse lassen sich recht einfach analysieren, teilweise auch an den nachgeschalteten Switches, sollte es an Kenntnissen der VM-Verwaltung mangeln. Meistens hilft aber schon ein analytischer Denkansatz um solchen Problemen auf die Schliche zu kommen.</p>
<p>Der Beitrag <a href="https://pixelfriedhof.com/grundlegende-sql-server-performance-sicherstellen/">Grundlegende SQL-Server-Performance sicherstellen</a> erschien zuerst auf <a href="https://pixelfriedhof.com">Pixelfriedhof</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://pixelfriedhof.com/grundlegende-sql-server-performance-sicherstellen/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
