<?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>www.dambeck.ch &#187; SQL</title>
	<atom:link href="http://www.dambeck.ch/tag/sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dambeck.ch</link>
	<description>Die andere Seite des Internets</description>
	<lastBuildDate>Fri, 14 Jan 2011 12:41:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Change the path SQL 2008 Server Database</title>
		<link>http://www.dambeck.ch/2009/08/30/change-the-path-sql-2008-server-database/</link>
		<comments>http://www.dambeck.ch/2009/08/30/change-the-path-sql-2008-server-database/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 17:29:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[EDV & Admin Stuff]]></category>
		<category><![CDATA[2007]]></category>
		<category><![CDATA[ldf]]></category>
		<category><![CDATA[master.mdf]]></category>
		<category><![CDATA[mdb]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.dambeck.ch/2009/08/30/change-the-path-sql-2008-server-database/</guid>
		<description><![CDATA[In the most cases there are benefits when all data (log and db) files are on the network storage. Think off the benefit in terms of performance and backup. The Install wizard of Microsoft SQL Server 2008 shows only the option to change the path of the temporary database. In this guide I show you [...]]]></description>
			<content:encoded><![CDATA[<p>In the most cases there are benefits when all data (log and db) files are on the network storage. Think off the benefit in terms of performance and backup. The Install wizard of Microsoft SQL Server 2008 shows only the option to change the path of the temporary database. In this guide I show you how to move the databases. Please keep in mind to create a backup of your db’s before starting. I know backup is only for hot shower takers, gym bag losers and armpit hair blow-dryers;-). On my test server the path looks like:
<p>master.mdf, masterlog.ldf
<p>C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER08\MSSQL\DATA
<p>Model.mdf, modellog.ldf
<p>C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER08\MSSQL\DATA
<p>MSDBdata.mdf, MSDBlog.mdf
<p>C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER08\MSSQL\DATA
<p>Tempdbv.mdf, templog.ldf
<p>C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER08\MSSQL\DATA
<p>planetgeek.mdf, planetgeek_log.ldf
<p>C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER08\MSSQL\DATA
<p>First thing you notice the filenames are all tuned in the same schema, pls. Microsoft it cannot be so hard. Our mission is to move all log files in the path D:\mssqlserver08 and all data files to E:\mssqlserver08. The first thing we should do is give the sqlserver service account user read and write rights to this two directories. This step is not quiet necessary but the remote db creation and auto grow features will not work. Let&#8217;s start with the master db. Start the SQL Server Configuration Manager. Click “start” -&gt; “run” and type “SQLServerManager10.msc” and right click on the properties from the SQL server Service.
<p><a href="http://www.dambeck.ch/wp-content/uploads/2009/08/clip-image002.jpg"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="141" alt="clip_image002" src="http://www.dambeck.ch/wp-content/uploads/2009/08/clip-image002-thumb.jpg" width="573" border="0"></a>
<p>In the advanced tab you have to edit the Startup Parameters
<p><a href="http://www.dambeck.ch/wp-content/uploads/2009/08/clip-image004.jpg"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="244" alt="clip_image004" src="http://www.dambeck.ch/wp-content/uploads/2009/08/clip-image004-thumb.jpg" width="222" border="0"></a>
<p>The default value is (keep in mind there are no spaces!!!):
<p>-dC:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER08\MSSQL\DATA\master.mdf;
<p>-eC:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER08\MSSQL\Log\ERRORLOG;
<p>-lC:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER08\MSSQL\DATA\mastlog.ldf
<p>-d is the path to the master.mdf
<p>-e path of the “ERRORLOG” File.
<p> -l is path to the ldf File
<p>After change the path to (keep in mind there are no spaces!!!):
<p>-dD:\mssqlserver08\master.mdf;
<p>-eD:\errorlog\ERRORLOG;
<p>-lE:\mssqlserver08\mastlog.ldf
<p>stop the sql server (for cluster use you can use an UNC path and share name. This is useful on relaxed security cluster environments). Copy the master db files to the new path. And start the SQL server Service. One step done four steps are left, so let&#8217;s move on with the temporary db. Open the SQL Server Management Studio and open a new query and enter the following lines
<p><a href="http://www.dambeck.ch/wp-content/uploads/2009/08/clip-image006.jpg"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="171" alt="clip_image006" src="http://www.dambeck.ch/wp-content/uploads/2009/08/clip-image006-thumb.jpg" width="244" border="0"></a>
<p>After the alter database statement you need to stop the Sql Server move the files in explorer to their new location and start the SQL Server Service. Many of you are maybe wondering why “ … name = tempdev, …” and the “name = templog” in the SQL query. This is the internal database name. A very easy name to get this name is stored procedure sp_help
<p><a href="http://www.dambeck.ch/wp-content/uploads/2009/08/clip-image007.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="117" alt="clip_image007" src="http://www.dambeck.ch/wp-content/uploads/2009/08/clip-image007-thumb.png" width="244" border="0"></a>
<p>with this procedure you are able to easily modify the path of all other databases. Normally we would have finished at this point. But after then years of experience as IT guy I know that “developers” often don’t care about path in the file system (developers who write for planetgeek are not this kind of developers <img src='http://www.dambeck.ch/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  . So we should change the default database creation path to ensure it will work even when we are not in the office (Yes the IT Professionals have Holydays;-).
<p><a href="http://www.dambeck.ch/wp-content/uploads/2009/08/clip-image009.jpg"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="130" alt="clip_image009" src="http://www.dambeck.ch/wp-content/uploads/2009/08/clip-image009-thumb.jpg" width="244" border="0"></a>
<p>Enjoy the comfort of non direct attached storage, RIDE ON
<p>Konrad </p>
]]></content:encoded>
			<wfw:commentRss>http://www.dambeck.ch/2009/08/30/change-the-path-sql-2008-server-database/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Restore einer MSSQL DB ohne Transaktions Log</title>
		<link>http://www.dambeck.ch/2008/04/30/restore-einer-mssql-db-ohne-transaktions-log/</link>
		<comments>http://www.dambeck.ch/2008/04/30/restore-einer-mssql-db-ohne-transaktions-log/#comments</comments>
		<pubDate>Wed, 30 Apr 2008 18:27:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[EDV & Admin Stuff]]></category>
		<category><![CDATA[DB]]></category>
		<category><![CDATA[mssql]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.dambeck.ch/2008/04/30/restore-einer-mssql-db-ohne-transaktions-log/</guid>
		<description><![CDATA[Das Wichtigste zuerst, Nicht am Produktiven System üben. Das folgende Beispiel nur im Absoluten Notfall verwenden. Alles ohne Garantie das es funzt und ihr nicht noch mehr zerstört. Bei allen die sich etwas mit dem MS SQL Server auseinander gesetzt haben wissen das es sich beim Transaktion log um das LDF File. Zuerst möchte ich [...]]]></description>
			<content:encoded><![CDATA[<p>Das Wichtigste zuerst, Nicht am Produktiven System üben. Das folgende Beispiel nur im Absoluten Notfall verwenden. Alles ohne Garantie das es funzt und ihr nicht noch mehr zerstört. Bei allen die sich etwas mit dem MS SQL Server auseinander gesetzt haben wissen das es sich beim Transaktion log um das LDF File. Zuerst möchte ich aber etwas näher auf die Funktion des Transaktionslog  eingehen für alle welche nicht so versiert mit Datenbanken sind. Wenn ein Programm eine Update in einer Datenbank macht wird dieses zuerst in das Transaktion log geschrieben. Der SQL Server Schreibt dann die Änderung  in die Eigentliche Datenbank<a href="http://www.dambeck.ch/wp-content/uploads/2008/04/ldf1.jpg"><img style="border-right: 0px; border-top: 0px; margin: 5px 5px 0px 0px; border-left: 0px; border-bottom: 0px" src="http://www.dambeck.ch/wp-content/uploads/2008/04/ldf1-thumb.jpg" border="0" alt="ldf1" width="244" height="141" align="left" /></a> (mdf). Für alle welche sich mal etwas im Transaktion log umschauen möchten gibt&#8217;s den Befehl &#8220;<em>DBCC log ( {dbid|dbname}, [, type={0|1|2|3|4}] )&#8221;.</em> Wobei ich eigentlich meistens zum Debuggen die Option 0 oder 1 verwende. Insgeheim Denke ich auch das man die leute welche mit der Option 4 Debuggen in der Matrix Leben und keine rl freunde haben <img src='http://www.dambeck.ch/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> . </p>
<p>Aber wieder zurück zum Thema. Also gehen wir mal davon aus das unser DB Server geratscht ist wegen einer Hard Disk wo das LDF File drauf war (Möchte hier nur anmerken das mir das noch nie passiert ist und so ein File auf ein Riad System gehört !!) Des weiter haben wir ein Backup der Datenbank welches <a href="http://www.dambeck.ch/wp-content/uploads/2008/04/ldif2.jpg"><img style="border-right: 0px; border-top: 0px; margin: 5px 0px 0px 5px; border-left: 0px; border-bottom: 0px" src="http://www.dambeck.ch/wp-content/uploads/2008/04/ldif2-thumb.jpg" border="0" alt="ldif2" width="244" height="108" align="right" /></a> eine stunden alt ist. Um dies zu simulieren habe ich im Windows Task Manager den &#8220;sqlservr.exe&#8221; beendet und die ldf Datei gelöscht. Da wir ja kein 0815 Admin sind. Geben wir uns nicht damit zufrieden unser Backup einfach so zurückzustellen und die Armen Kunden (Anwender) die letzen stunden einfach nochmal so einzugeben. Also werfen wir den DB Server mal wieder an. Das unsere Datenbank sich als suspect meldet springt uns als erstes in Auge (sihe PRTSCR 2). Wenn wir versuchen einen Zugriff zu machen wird dies geblockt das kein Transaktion log da ist. Aber wir komme ich weiter ?</p>
<p>Wir besinnen uns auf den SQL Kurs den wir nie hatten und beginnen zu weinen <img src='http://www.dambeck.ch/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> . Wir können auch etwas Rumsuchen in dem SQL Books Online bei Microsoft. Oder wir Erinnern uns an den von Microsoft nicht dokumentierten befehl DBCC. Ok ich gebe zu in diversen KB artikeln wird mit dem ding rumgebastelt. Oder wir können etwas Googeln und gelangen zu einem Scribt was so ähnlich ist wie dieses Hier.</p>
<p><em>EXEC sp_configure &#8216;allow updates&#8217;, 1<br />
RECONFIGURE WITH OVERRIDE<br />
GO </em></p>
<p><em>BEGIN TRAN<br />
UPDATE master..sysdatabases<br />
SET status = status | 32768<br />
WHERE name = &#8216;RocketSience&#8217;<br />
IF @@ROWCOUNT = 1<br />
BEGIN<br />
   COMMIT TRAN<br />
   RAISERROR(&#8216;emergency mode set&#8217;, 0, 1)<br />
END<br />
ELSE<br />
BEGIN<br />
   ROLLBACK<br />
   RAISERROR(&#8216;unable to set emergency mode&#8217;, 16, 1)<br />
END<br />
GO<br />
EXEC sp_configure &#8216;allow updates&#8217;, 0<br />
RECONFIGURE WITH OVERRIDE<br />
GO<br />
&#8211; Hier den SQL Server neu starten (Service Reicht). </em></p>
<p><em>DBCC REBUILD_LOG(&#8216;RocketSience&#8217;,'D:\SQLDB\MSSQL$STARFLEETDB\Data\RocketSience_log.LDF&#8217;)<br />
/*Hier Testen ob alles wieder geht !!!!!!<br />
Keine garantie das meine DB Konsistent ist */<br />
ALTER DATABASE RocketSience SET MULTI_USER<br />
GO</em></p>
<p>Und schon lebt unsere Datenbank Wieder. Zum beweis das wir auch ein neues TRN Log haben noch dieser PRTSCR <a href="http://www.dambeck.ch/wp-content/uploads/2008/04/ldif4.jpg"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" src="http://www.dambeck.ch/wp-content/uploads/2008/04/ldif4-thumb.jpg" border="0" alt="ldif4" width="244" height="178" /></a></p>
<p>Das Scribt habe ich euch natürlich auch als <a href="http://www.dambeck.ch/wp-content/uploads/ldf.sql" target="_blank">TXT Datei bereit</a> gelegt.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dambeck.ch/2008/04/30/restore-einer-mssql-db-ohne-transaktions-log/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Rocket Sience on SQL Server 2k Transaktion</title>
		<link>http://www.dambeck.ch/2008/04/11/rocket-sience-on-sql-server-2k-transaktion/</link>
		<comments>http://www.dambeck.ch/2008/04/11/rocket-sience-on-sql-server-2k-transaktion/#comments</comments>
		<pubDate>Fri, 11 Apr 2008 20:01:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[EDV & Admin Stuff]]></category>
		<category><![CDATA[Rocket Sience]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Transaction]]></category>

		<guid isPermaLink="false">http://www.dambeck.ch/2008/04/11/rocket-sience-on-sql-server-2k-transaktion/</guid>
		<description><![CDATA[Wir hatten das Letzte mal bei einer Pizza eine Spande&#160; Diskussion &#252;ber Transaktionen im SQL Server 2000. Die runde bestand aus zwei Sys-Admins&#160; einem WI und einen Software Devloper. Irgendwann Kamm das Thema mit der Lange einer Transaktion auf bzw was passiert wen ein anderer Prozess in der gleichen Zeit auf eine Row (Zeile) zugeiffen [...]]]></description>
			<content:encoded><![CDATA[<p>Wir hatten das Letzte mal bei einer Pizza eine Spande&#160; Diskussion &#252;ber Transaktionen im SQL Server 2000. Die runde bestand aus zwei Sys-Admins&#160; einem WI und einen Software Devloper. Irgendwann Kamm das Thema mit der Lange einer Transaktion auf bzw was passiert wen ein anderer Prozess in der gleichen Zeit auf eine Row (Zeile) zugeiffen will. Nach dem wir uns nicht richtig einig geworden sein will ich den beweis antreten. Das Setup besteht aus einem SQL Server 2000 ohne SP und SA PW(ich weiss das ist b&#246;se aber in VM was Solls). </p>
<p>Die ganze Ding&#160; ist auch ganz Easy aufgebaut. </p>
<p><a href="http://www.dambeck.ch/wp-content/uploads/2008/04/rs1.jpg"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="199" alt="RS1" src="http://www.dambeck.ch/wp-content/uploads/2008/04/rs1-thumb.jpg" width="244" border="0" /></a> </p>
<p>Zum Simulieren von 2 Verschiedenen Prozessen nehme ich 2 SQL Query Anlyzer. Im Ersten starte ich eine Transaktion und werde das &quot;Value&quot; um eins nachz&#228;hlen, die Transaktion aber noch nicht abschliessen. Dann werde ich im zweiten Query Anlyzer den wert der zuerst auslesen und danach auf 20 Setzen. Jetzt werde ich die Transaktion abschliessen. </p>
<p>Jetzt ist die Grosse Frage was ist der Wert im &quot;Value&quot; m&#246;glich w&#228;hre 20, 2, 22 oder ein Absturz des SQL Server&#8217;s <img src='http://www.dambeck.ch/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><a href="http://www.dambeck.ch/wp-content/uploads/2008/04/rs2.jpg"><img style="border-right: 0px; border-top: 0px; margin: 0px 5px 0px 0px; border-left: 0px; border-bottom: 0px" height="244" alt="rs2" src="http://www.dambeck.ch/wp-content/uploads/2008/04/rs2-thumb.jpg" width="167" align="left" border="0" /></a> </p>
<p>&#160;</p>
<p>&#160;</p>
<p>Wir Start also die Transaktion und machen einen Update um plus eins. Wir bemerken die &quot;&#8211;&quot; welche das &quot;commit tran&quot; zum Kommentar erkl&#228;ren. </p>
<p>&#160;</p>
<p><a href="http://www.dambeck.ch/wp-content/uploads/2008/04/rs3.jpg"></a></p>
<p>&#160;<a href="http://www.dambeck.ch/wp-content/uploads/2008/04/rs3.jpg"><img style="border-right: 0px; border-top: 0px; margin: 0px 0px 0px 5px; border-left: 0px; border-bottom: 0px" height="230" alt="RS3" src="http://www.dambeck.ch/wp-content/uploads/2008/04/rs3-thumb.jpg" width="244" align="right" border="0" /></a></p>
<p>Der Select kann keinen wert auslesen da sie Tabelle von der Transaktion blockiert wird. Wir sehen das Query lauft auf diesem bild bereits 3min 12 Sek. Also brechen wir das mal ab und starten den Update auf den Wert &quot;20&quot;. es zeigt sich wieder das gleiche Ph&#228;nomen.</p>
<p>&#160;</p>
<p>&#160;</p>
<p><a href="http://www.dambeck.ch/wp-content/uploads/2008/04/rs4.jpg"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="127" alt="RS4" src="http://www.dambeck.ch/wp-content/uploads/2008/04/rs4-thumb.jpg" width="419" border="0" /></a> </p>
<p>Im Enterprise Manager sehen wir sch&#246;n die Gebockten Prozesse. in der Datenbank. </p>
<p>So also zur Aufl&#246;sung: Da ich den Update gemacht habe w&#228;hrend der Transaktion und ihn laufen lassen habe, &quot;commit tran&quot; ausfuhrt habe. Der Update sich innert Sekunden gel&#246;st hat, wurde das Value welches 2 wahr mit 20 &#252;berschreiben. Das Ergebniss ist also ZWANZIG</p>
<p>I Win You Lose <img src='http://www.dambeck.ch/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.dambeck.ch/2008/04/11/rocket-sience-on-sql-server-2k-transaktion/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Suchen in SQL Server 2k</title>
		<link>http://www.dambeck.ch/2008/02/28/suchen-in-sql-server-2k/</link>
		<comments>http://www.dambeck.ch/2008/02/28/suchen-in-sql-server-2k/#comments</comments>
		<pubDate>Thu, 28 Feb 2008 21:32:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[EDV & Admin Stuff]]></category>
		<category><![CDATA[2000]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Suchen]]></category>

		<guid isPermaLink="false">http://www.dambeck.ch/2008/02/28/suchen-in-sql-server-2k/</guid>
		<description><![CDATA[Heute habe ich was &#34;geiles&#34; (sorry f&#252;r das Wort) gelernt bzw. Kopiert. Da ich im Moment am Migrieren von Datei Servern bin habe ich das Problem das ca 1000 Anwendungen da ihre Pfade haben. Inklusive einer Netten Datenbank Anwendung. Also anstatt gef&#252;hlte 10&#8217;000&#8217;000&#8217;000&#8217;000 Tabellen durchzusehen gibt&#8217;s ein kleines Scribt welches Spaltennamen sucht. SELECT&#160;&#160;&#160;&#160; distinct object_name(id) [...]]]></description>
			<content:encoded><![CDATA[<p>Heute habe ich was &quot;geiles&quot; (sorry f&#252;r das Wort) gelernt bzw. Kopiert. Da ich im Moment am Migrieren von Datei Servern bin habe ich das Problem das ca 1000 Anwendungen da ihre Pfade haben. Inklusive einer Netten Datenbank Anwendung. Also anstatt gef&#252;hlte 10&#8217;000&#8217;000&#8217;000&#8217;000 Tabellen durchzusehen gibt&#8217;s ein kleines Scribt welches Spaltennamen sucht.</p>
<p><em>SELECT&#160;&#160;&#160;&#160; distinct object_name(id)      <br />FROM&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; syscolumns       <br />WHERE&#160;&#160;&#160;&#160; (name LIKE &#8216;%folder%&#8217;)</em></p>
<p>Ok ich gebe zu das Ding ist nicht der Stein der Weisen. Aber immerhin mal ein Anfang. Nur das %folder%&quot; durch den Suchbegriff ersetzen.</p>
<p><a href="http://www.dambeck.ch/wp-content/uploads/2008/02/sqlquerya.jpg"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="321" alt="SQLQueryA" src="http://www.dambeck.ch/wp-content/uploads/2008/02/sqlquerya-thumb.jpg" width="407" border="0" /></a> </p>
<p>THX to DOG &amp; RIGGI</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dambeck.ch/2008/02/28/suchen-in-sql-server-2k/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL junkie Serach &amp; Replace</title>
		<link>http://www.dambeck.ch/2007/08/21/sql-junkie-serach-replace/</link>
		<comments>http://www.dambeck.ch/2007/08/21/sql-junkie-serach-replace/#comments</comments>
		<pubDate>Tue, 21 Aug 2007 21:32:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[EDV & Admin Stuff]]></category>
		<category><![CDATA[Replace]]></category>
		<category><![CDATA[Serach]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SUCHBEGRIFF]]></category>

		<guid isPermaLink="false">http://www.dambeck.ch/wordpress/?p=33</guid>
		<description><![CDATA[Heute habe ich mich selber übertroffen, ok ich weiss selbts lob stinkt aber guckt euch mal dieses herlich SQL statmend an. ok ich hatte etwa 2 Stunden und jedemenge hilfe aus dem gbi. Aber trozdem bin ich stoltz darauf DECLARE  @find      varchar(255),                 @replace   varchar(255),                @patfind   varchar(255) SELECT   @find    = &#8216;SUCHBEGRIFF&#8217;                @replace = &#8216;RESATZTBEGRIFF&#8217; SELECT   [...]]]></description>
			<content:encoded><![CDATA[<p>Heute habe ich mich selber übertroffen, ok ich weiss selbts lob stinkt aber guckt euch mal dieses herlich SQL statmend an. ok ich hatte etwa 2 Stunden und jedemenge hilfe aus dem gbi. Aber trozdem bin ich stoltz darauf <img src='http://www.dambeck.ch/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><em>DECLARE  @find      varchar(255), </p>
<p>               @replace   varchar(255),</p>
<p>               @patfind   varchar(255)</p>
<p>SELECT   @find    = &#8216;SUCHBEGRIFF&#8217; </p>
<p>              @replace = &#8216;RESATZTBEGRIFF&#8217;</p>
<p>SELECT   @patfind = &#8216;%&#8217; + @find + &#8216;%&#8217;</p>
<p></em></p>
<p><em>UPDATE   [TABELLE]</p>
<p>SET      [SPALTENNAHME = STUFF( [SPALTENNAHME],</p>
<p>                              PATINDEX( @patfind, [SPALTENNAHME] ),</p>
<p>                              DATALENGTH( @find ),</p>
<p>                              @replace )</p>
<p></em></p>
<p><em>WHERE    [SPALTENNAHME] LIKE @patfind</p>
<p>go</em></p>
<p><em>&#8211;   THX to all SQL Junkie in the net</p>
<p>&#8211;   &#8216;SUCHBEGRIFF&#8217;  kann mit &#8216;%SUCHBEGRIFF%&#8217; auf eine like ausgeweitet werden !!</p>
<p>&#8211;    PLS Backupt eure Tabellen ich kann keine haftung übernehen aber es funzt !!!</em></p>
<p>Das Skribt wurde auf einem Microsoft SQL Server 2000 und 2005 getestet</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dambeck.ch/2007/08/21/sql-junkie-serach-replace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

