<?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>Ed&#039;s Place &#187; SQL Scripting</title>
	<atom:link href="http://www.edfrancis.co.uk/category/databases/sql-scripting/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.edfrancis.co.uk</link>
	<description>The home of Ed&#039;s Rants and Raves since 2008!</description>
	<lastBuildDate>Tue, 13 Jul 2010 16:33:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Setting the SQL Server Campatibility mode to 90 on all databases</title>
		<link>http://www.edfrancis.co.uk/2008/05/setting-the-sql-server-campatibility-mode-to-90-on-all-databases/</link>
		<comments>http://www.edfrancis.co.uk/2008/05/setting-the-sql-server-campatibility-mode-to-90-on-all-databases/#comments</comments>
		<pubDate>Fri, 30 May 2008 15:24:13 +0000</pubDate>
		<dc:creator>Ed Francis</dc:creator>
				<category><![CDATA[SQL Scripting]]></category>

		<guid isPermaLink="false">http://blog.mrfrancis.net/?p=29</guid>
		<description><![CDATA[OK, so I know I&#8217;m jumping the gun a little, I&#8217;ll be posting some stuff about how I moved over my databases to the SQL 2005 box later. I&#8217;ve just been working on this stuff all morning so I thought I&#8217;d upload the script I wrote quickly. This script creates as an output a number [...]]]></description>
			<content:encoded><![CDATA[<p>OK, so I know I&#8217;m jumping the gun a little, I&#8217;ll be posting some stuff about how I moved over my databases to the SQL 2005 box later. I&#8217;ve just been working on this stuff all morning so I thought I&#8217;d upload the script I wrote quickly.<br />
This script creates as an output a number of SQL commands that will change the compatibility modes of all databases on your server. That said, if you change the command in the cursor, it can be used to change anything on all databases.<br />
Basically, you just run the script, copy the outcome and run that. This will allow you to remove any databases you don&#8217;t want or change anything you like before running the eventual script.<br />
The script genrating script idea was one I pinched from Microsoft I&#8217;m afraid.</p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: center;"><a href="http://mrfrancis.net/codesamples/Setting the SQL Server Campatibility mode to 90 on all databases.txt" target="_blank">Click Here to get the Code</a></p>
<p>Run it then in the results pane you&#8217;ll see all the commands ready to be copied and pasted into the query window.<br />
Nice! <img src='http://www.edfrancis.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.edfrancis.co.uk/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.edfrancis.co.uk/2008/05/setting-the-sql-server-campatibility-mode-to-90-on-all-databases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finding out the paths to SQL Database Data Files</title>
		<link>http://www.edfrancis.co.uk/2008/05/finding-out-the-paths-to-sql-database-data-files/</link>
		<comments>http://www.edfrancis.co.uk/2008/05/finding-out-the-paths-to-sql-database-data-files/#comments</comments>
		<pubDate>Tue, 27 May 2008 10:05:46 +0000</pubDate>
		<dc:creator>Ed Francis</dc:creator>
				<category><![CDATA[SQL Scripting]]></category>

		<guid isPermaLink="false">http://blog.mrfrancis.net/?p=24</guid>
		<description><![CDATA[  Finding out the data and log file locations in SQL Server can sometimes be a little fiddly. With that in mind, I’ve been looking for a way to list the files used by each database. Whether for system or disaster recovery documentation, it can sometimes be handy to have this kind of info available [...]]]></description>
			<content:encoded><![CDATA[<p style="MARGIN: 0cm 0cm 0pt"> </p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="font-size: small; font-family: Arial;">Finding out the data and log file locations in SQL Server can sometimes be a little fiddly. With that in mind, I’ve been looking for a way to list the files used by each database. Whether for system or disaster recovery documentation, it can sometimes be handy to have this kind of info available to you.</span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="font-size: small; font-family: Arial;">Finding out where the mdf (database file) is can be pretty easy. Its held in the Master database somewhere. Its only when you want to check where both the mdf and ldf (transaction log file) are stored that it can get a bit tricky.</span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="font-size: small; font-family: Arial;"> </span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="font-size: small; font-family: Arial;">The way I’ve been doing it involves a cursor that creates a new line in a temporary database for each database you have on that particular server. Ordinarily to get where the database and log files are kept you’d use a query like the one below:</span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="font-size: small; font-family: Arial;">EXEC sp_helpdb ‘master’</span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="font-size: small; font-family: Arial;"> </span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="font-size: small; font-family: Arial;">What I’ll be doing is something that works similar to this but basically does it for all the databases in one command.</span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="font-size: small; font-family: Arial;">Get the name of the first database </span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="font-size: small; font-family: Arial;">Query the database for its file locations, writing them to the temporary database</span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="font-size: small; font-family: Arial;">Get the name of the second database…..</span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="font-size: small; font-family: Arial;">Etc</span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="font-size: small; font-family: Arial;"> </span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="font-size: small; font-family: Arial;">So, here goes with the actual code:</span> <br />
 </p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: center;"><span style="font-size: small; font-family: Arial;"><a href="http://mrfrancis.net/codesamples/Finding out the paths to SQL Database Data Files.txt" target="_blank">Click Here to get the Code</a> </span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> </p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="font-size: small; font-family: Arial;">I don’t have any databases that use more than the primary filegroup so I’m afraid this won’t help users that may be doing that.</span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="font-size: small; font-family: Arial;">For us simple people however, this will give you a report that can be used in disaster recovery docs and the like for years to come. <img src='http://www.edfrancis.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </span></p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> </p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.edfrancis.co.uk/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.edfrancis.co.uk/2008/05/finding-out-the-paths-to-sql-database-data-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
