<?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; Databases</title>
	<atom:link href="http://www.edfrancis.co.uk/category/databases/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>
		<item>
		<title>Setting up DSN Connections</title>
		<link>http://www.edfrancis.co.uk/2008/04/setting-up-dsn-connections/</link>
		<comments>http://www.edfrancis.co.uk/2008/04/setting-up-dsn-connections/#comments</comments>
		<pubDate>Tue, 15 Apr 2008 13:49:42 +0000</pubDate>
		<dc:creator>Ed Francis</dc:creator>
				<category><![CDATA[Databases]]></category>

		<guid isPermaLink="false">http://blog.mrfrancis.net/?p=13</guid>
		<description><![CDATA[Setting up a Data Source Name (or DSN) in Windows is something akin to falling off a log, once you&#8217;ve found the appropriate log, falling off it is child&#8217;s play! Windows comes with a number of Open DataBase Connectivity (ODBC) drivers already installed. Things like Access and SQL server are easily contactable from the get [...]]]></description>
			<content:encoded><![CDATA[<p>Setting up a Data Source Name (or DSN) in Windows is something akin to falling off a log, once you&#8217;ve found the appropriate log, falling off it is child&#8217;s play!</p>
<p>Windows comes with a number of Open DataBase Connectivity (ODBC) drivers already installed. Things like Access and SQL server are easily contactable from the get go, its only when you look at database systems from other suppliers that you need to think about downloading drivers.</p>
<p>Products such as Oracle, MySQL, PostgreSQL and the like will require their own drivers installing before they become an option for DSNs. When you think about it, it kind of makes sense. Why should Microsoft try to write the driver when the one from the manufacturer will do the job much better and will probably go through many incarnations before the next Windows release?</p>
<p>I&#8217;ll talk you through how to set up a vanilla, ready salted, sorbet of a DSN setup that will hopefully point you in the right direction if you&#8217;re using other clients.</p>
<p>OK, here goes:</p>
<ul>
<li>Go to Control Panel</li>
<li>Double click Administrative Tools</li>
<li>Open Data Sources (ODBC)</li>
</ul>
<p>There are a number tabs available to you at this juncture, I&#8217;ll be concentrating on System DSN in these instructions. Please see my notes at the end of this post for a little further information about the others.</p>
<ul>
<li>Click the System DSN Tab</li>
<li>Click the Add&#8230; button</li>
<li>At this point you must choose the ODBC drive you&#8217;re going to use for the DSN, select SQL Server for now</li>
<li>In the Name box type the name you want the DSN to have</li>
<li>Type a meaningful description in the Description box</li>
<li>Drop down the list at the bottom to select the server you wish to connect to</li>
<li>Click Next</li>
</ul>
<p>At this point you&#8217;ll be asked about how you&#8217;d like to connect to the server, you&#8217;ve got two options:</p>
<blockquote><p><strong>Windows Authentication</strong> uses the credentials of the user that&#8217;s currently logged in to the PC. Its OK from most connections as long as the database administrator has set up the user on the SQL server.</p>
<p><strong>SQL Server Authentication</strong> is used when you&#8217;d like to connect to the server as a SQL Server user  account. It doesn&#8217;t care who you&#8217;re logged in as, you&#8217;ll authenticate as this user. In order for this to work, your dba will need to have created a SQL user and be running the server in question in Mixed Mode Authentication mode.</p></blockquote>
<ul>
<li>Leaving the authentication as Windows for now, we&#8217;ll move on. Click next</li>
<li>Now you have the option to change the database you&#8217;ll automatically connect to and some other settings to do with ANSI identifiers and nulls, ignore the lot and click Next</li>
<li>At this screen you get the options for logging, encryption and languages, leaving these as they are you click Finish and away you go.</li>
</ul>
<p>This is the most basic form of connection you can have. Using this you can create linked tables in Access, reports in Crystal Reports, use pass through queries, the lot!</p>
<p> </p>
<p><strong>Notes</strong></p>
<p><em>Types of DSN</em> &#8211; There are three major types of DSN: User DSNs, System DSNs and File DSNs.<br />
User DSNs are used to create data sources that only that user will need. If you have roaming profiles enabled, they&#8217;ll follow the user about too.<br />
System DSNs are machine specific and don&#8217;t care who&#8217;s logged in. They&#8217;re handy for things like reception desks and so such where the user can frequently change but the information available must always be there.<br />
File DSNs are simply files that hold DSN information.</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/04/setting-up-dsn-connections/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating Pass-Through queries in Access 2003</title>
		<link>http://www.edfrancis.co.uk/2008/04/creating-pass-through-queries-in-access-2003/</link>
		<comments>http://www.edfrancis.co.uk/2008/04/creating-pass-through-queries-in-access-2003/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 12:41:08 +0000</pubDate>
		<dc:creator>Ed Francis</dc:creator>
				<category><![CDATA[Access]]></category>

		<guid isPermaLink="false">http://blog.mrfrancis.net/?p=12</guid>
		<description><![CDATA[A pass-through query is one where your command is passed from MS Access over to the server to execute. Sounds a little tricky, I know, but you&#8217;ll get the hang of it. OK, lets start with the scenario that you want to access a stored procedure (sometimes called a sproc) called sp_this_one on a SQL Server somewhere [...]]]></description>
			<content:encoded><![CDATA[<p>A pass-through query is one where your command is passed from MS Access over to the server to execute. Sounds a little tricky, I know, but you&#8217;ll get the hang of it.</p>
<p>OK, lets start with the scenario that you want to access a stored procedure (sometimes called a sproc) called sp_this_one on a SQL Server somewhere in your organisation.<br />
In order to run this sproc you&#8217;d normally issue the command <em>EXEC sp_this_one</em> in Query Analyser or some such tool.</p>
<p>In order to run this sproc in access, you just need to make a pass-through query with that exec statement. Easy as.</p>
<p>Assuming you&#8217;ve already set up a Data Source Name (or DSN) to your SQL Server&#8217;s database (don&#8217;t worry, I&#8217;ll be writing about how to do that in another post) the process is straightforward.</p>
<ol>
<li>Create a query</li>
<li>Close the Tables box</li>
<li>Go to the Query Menu</li>
<li>Select SQL Specific &gt; Pass-Through Query</li>
<li>Click the Properties button on the toolbar</li>
<li>ODBC Connection String</li>
<li>&#8230; button</li>
<li>Select data source</li>
</ol>
<p>And that&#8217;s it. All you need to do then is type into the query window the command you&#8217;d like to pass through to the server. In our case EXEC sp_this_one.</p>
<p>I realise I&#8217;ve been using some rather broad strokes in these instructions, please feel free to email me if you&#8217;d like a slightly better description.</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/04/creating-pass-through-queries-in-access-2003/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
