<?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>Scott Means &#187; database</title>
	<atom:link href="http://smeans.com/category/coding/database/feed/" rel="self" type="application/rss+xml" />
	<link>http://smeans.com</link>
	<description>Ripping the envelope of software development, one technology at a time.</description>
	<lastBuildDate>Tue, 15 Nov 2011 20:44:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Dealing with Google App Engine development datastore.</title>
		<link>http://smeans.com/2011/10/30/dealing-with-google-app-engine-development-datastore/</link>
		<comments>http://smeans.com/2011/10/30/dealing-with-google-app-engine-development-datastore/#comments</comments>
		<pubDate>Sun, 30 Oct 2011 20:19:20 +0000</pubDate>
		<dc:creator>smeans</dc:creator>
				<category><![CDATA[Google App Engine]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[database]]></category>

		<guid isPermaLink="false">http://smeans.com/?p=358</guid>
		<description><![CDATA[Make managing your development datastore in Google App Engine much easier.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using GAE for a couple of years now, and I&#8217;ve become pretty much accustomed to its foibles, except for one: it occasionally wipes out my development datastore for no apparent reason. It always happens when I have to restart the dev. server application, and it usually happens when I switch between two of my applications. But whatever the cause, it can be <em>really</em> annoying. So I&#8217;ve found a workaround of sorts.</p>
<p>Digging thorough the development server documentation, I found two options that are making my life <u>much</u> easier:</p>
<dl>
<dt>&#8211;use_sqlite</dt>
<dd>Use <a href="http://www.sqlite.org/">sqlite</a> for the local datastore.</dd>
<dt>&#8211;datastore_path=[path to datastore file]</dt>
<dd>Keep the datastore in the file specified.</dd>
</dl>
<p>By doing these two things, you can now see where GAE is keeping your datastore and you can make intermediate backups and restore them at will. You can also view your datastore using the command line sqlite client. Just add these two parameters to the Extra Flags box in your app&#8217;s info in the App Engine Launcher (or to the command line) and you&#8217;re good to go. Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://smeans.com/2011/10/30/dealing-with-google-app-engine-development-datastore/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My MySQL tool is on softpedia.com.</title>
		<link>http://smeans.com/2009/06/18/my-mysql-tool-is-on-softpediacom/</link>
		<comments>http://smeans.com/2009/06/18/my-mysql-tool-is-on-softpediacom/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 20:06:21 +0000</pubDate>
		<dc:creator>smeans</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://smeans.com/?p=184</guid>
		<description><![CDATA[I just got the notice today. I wrote this bulk row insert tool for MySQL that is designed to run over the Internet. It&#8217;s for really large data sets being loaded into &#8230; ahem &#8230; inexpensive hosted MySQL databases. Check out the mysqlxfer softpedia page.]]></description>
			<content:encoded><![CDATA[<p>I just got the notice today. I wrote this bulk row insert tool for MySQL that is designed to run over the Internet. It&#8217;s for really large data sets being loaded into &#8230; ahem &#8230; <em>inexpensive</em> hosted MySQL databases. Check out the <a href="http://www.softpedia.com/get/Internet/Servers/Database-Utils/mysqlxfer.shtml">mysqlxfer softpedia page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://smeans.com/2009/06/18/my-mysql-tool-is-on-softpediacom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The mother of all dynamic SQL Crosstab View Builders.</title>
		<link>http://smeans.com/2009/02/03/the-mother-of-all-dynamic-sql-crosstab-view-builders/</link>
		<comments>http://smeans.com/2009/02/03/the-mother-of-all-dynamic-sql-crosstab-view-builders/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 19:53:35 +0000</pubDate>
		<dc:creator>smeans</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[life]]></category>
		<category><![CDATA[crosstab]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://smeans.com/?p=110</guid>
		<description><![CDATA[Ok, so maybe it&#8217;s not too poetic, but it&#8217;s descriptive. As I found myself writing a dynamic crosstab-query builder in MS SQL for probably the fifth time of my career, I decided I&#8217;d post it here to save you all just a little time in your day. Make sure you use the saved time for [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, so maybe it&#8217;s not too poetic, but it&#8217;s descriptive. As I found myself writing a dynamic crosstab-query builder in MS SQL for probably the fifth time of my career, I decided I&#8217;d post it here to save you all just a little time in your day. Make sure you use the saved time for something I&#8217;d approve of (smoking a good cigar, playing a little poker, something like that).</p>
<p>This proc is designed for when you have a dynamic set of row-oriented data you want to pivot and show column-wise. It takes four parameters:</p>
<p>@tableName &#8211; Name of the source table (or view) that will be queried by the new crosstab view.<br />
@excludeCols &#8211; A comma separated list of columns to exclude from the crosstab. In most cases, will be the ID column of the table.<br />
@valueColName &#8211; Name of the column in the @tableName table that contains the value in a given row.<br />
@targetViewName &#8211; Name of the view that the stored procedure will create. It will *automatically* drop this view before re-creating it, so be warned.</p>
<p>This proc also assumes that the @tableName table (or view) has a column called [colName]. It uses this value to create the corresponding columns across the top of the output view.</p>
<p>Good luck!</p>
<p><code><br />
ALTER PROCEDURE BuildCrosstabView(<br />
	@tableName VARCHAR(100),<br />
	@excludeCols VARCHAR(1000),<br />
	@valueColName VARCHAR(1000),<br />
	@targetViewName VARCHAR(100)<br />
)<br />
AS<br />
BEGIN<br />
	-- SET NOCOUNT ON added to prevent extra result sets from<br />
	-- interfering with SELECT statements.<br />
	SET NOCOUNT ON;</p>
<p>	DECLARE @cols VARCHAR(4000)<br />
	SET @cols = ''</p>
<p>	EXEC ('SELECT DISTINCT colName INTO ##colList FROM ' + @tableName)<br />
	DECLARE col_cursor CURSOR FOR<br />
	SELECT colName<br />
	FROM ##colList</p>
<p>	OPEN col_cursor</p>
<p>	DECLARE @colName VARCHAR(100)</p>
<p>	FETCH NEXT FROM col_cursor INTO @colName</p>
<p>	WHILE @@FETCH_STATUS = 0<br />
	BEGIN</p>
<p>	IF @cols <> ''<br />
	BEGIN<br />
		SET @cols = @cols + ', '<br />
	END</p>
<p>	SET @cols = @cols + 'MAX(CASE colName WHEN ''' + @colName + ''' THEN ' + @valueColName + ' ELSE NULL END) AS [' + @colName + ']<br />
'<br />
	FETCH NEXT FROM col_cursor INTO @colName</p>
<p>	END</p>
<p>	CLOSE col_cursor<br />
	DEALLOCATE col_cursor</p>
<p>	DROP TABLE ##colList</p>
<p>	DECLARE @sql VARCHAR(3000)<br />
	SET @sql = 'SELECT DISTINCT ' + @excludeCols + ', ' + @cols + ' FROM ' + @tableName + ' GROUP BY ' + @excludeCols<br />
	PRINT @sql<br />
	EXECUTE (@sql)<br />
	IF EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[' + @targetViewName + ']'))<br />
		EXECUTE ('DROP VIEW ' + @targetViewName)<br />
	EXECUTE ('CREATE VIEW ' + @targetViewName + ' AS ' + @sql)<br />
END<br />
GO<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://smeans.com/2009/02/03/the-mother-of-all-dynamic-sql-crosstab-view-builders/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bulk SQL inserting, anyone?</title>
		<link>http://smeans.com/2008/12/14/bulk-sql-inserting-anyone/</link>
		<comments>http://smeans.com/2008/12/14/bulk-sql-inserting-anyone/#comments</comments>
		<pubDate>Sun, 14 Dec 2008 19:50:45 +0000</pubDate>
		<dc:creator>smeans</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[open-source]]></category>

		<guid isPermaLink="false">http://smeans.com/?p=90</guid>
		<description><![CDATA[As part of the BlinkStory app, I needed to upload about 200K (200 thousand, for the geek-impaired) records into a MySql database hosted on a very inexpensive (cheap) hosting provider. I&#8217;d tried several options to get the data in, with frustrating results. Either my file upload would be interrupted, or an error would occur around [...]]]></description>
			<content:encoded><![CDATA[<p>As part of the BlinkStory app, I needed to upload about 200K (200 thousand, for the geek-impaired) records into a MySql database hosted on a very inexpensive (cheap) hosting provider. I&#8217;d tried several options to get the data in, with frustrating results. Either my file upload would be interrupted, or an error would occur around row 75K, wasting an hour or so of my time.</p>
<p>So I decided, like any good programmer, to roll my own solution. I created a tool for <a href="https://sourceforge.net/projects/mysqlxfer/">bulk uploading SQL over the Internet</a> that I call mysqlxfer. Not wanting to hoard it, I submitted it to <a href="http://sourceforge.net">SourceForge.net</a> as an open source project. If you need to upload a bunch of data over an unreliable and slow connection, give it a shot. It does a couple of cool things, like automatically detecting your field separator character and logging the failed inserts in SQL format to a .err file. Check it out!</p>
]]></content:encoded>
			<wfw:commentRss>http://smeans.com/2008/12/14/bulk-sql-inserting-anyone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

