<?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>DMTechZing &#187; Database</title>
	<atom:link href="http://dmentionsystems.com/blogs/dmtechzing/category/database/feed/" rel="self" type="application/rss+xml" />
	<link>http://dmentionsystems.com/blogs/dmtechzing</link>
	<description>Developer oriented posts from the D&#039;Mention Systems crew.</description>
	<lastBuildDate>Fri, 23 Oct 2009 05:25:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Mysqldump equivalent for Microsoft SQL Server</title>
		<link>http://dmentionsystems.com/blogs/dmtechzing/2009/08/19/mysqldump-equivalent-for-microsoft-sql-server/</link>
		<comments>http://dmentionsystems.com/blogs/dmtechzing/2009/08/19/mysqldump-equivalent-for-microsoft-sql-server/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 16:18:51 +0000</pubDate>
		<dc:creator>Andrew Hollamon</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://dmentionsystems.com/blogs/dmtechzing/?p=20</guid>
		<description><![CDATA[If you end up working in a wide variety of systems, you inevitably end up on system X, wishing that you had a specific tool or feature from system Y.
Today this happened to me, in that I wished I had something like mysqldump, but for MS SQL Server.  The pointy-clicky stuff is fine in certain [...]]]></description>
			<content:encoded><![CDATA[<p>If you end up working in a wide variety of systems, you inevitably end up on system X, wishing that you had a specific tool or feature from system Y.</p>
<p>Today this happened to me, in that I wished I had something like mysqldump, but for MS SQL Server.  The pointy-clicky stuff is fine in certain circumstances, but fails spectacularly in others.</p>
<p>This is a scenario where I didn&#8217;t own both boxes, and only have limited access to the source machine.  So detach/attach and many other options are out of the picture.  Copy database fails in a variety of ways in this situation, and the Export Data function also fails, as it&#8217;s not smart enough to try to insert table records in the right order to satisfy foreign key constraints.</p>
<p>And to top it off, I&#8217;d really like to have a nice snapshot of schema and data (this is a very small db) to push into SVN.</p>
<p>Unfortunately, the built in tools for MS SQL failed quite spectacularly here.  This is a particularly frustrating limitation, as what should have been a 10-minute process to recreate the database on a new box turns into a sticky mess.</p>
<p>Fortunately, there is a solution, and it works quite well.  To top things off, it&#8217;s open source (MS-PL) and created by Microsoft.</p>
<p>Enter the <a href="http://sqlhost.codeplex.com/Wiki/View.aspx?title=Database%20Publishing%20Wizard" target="_blank">Database Publishing Wizard</a>, which is a part of the <a href="http://sqlhost.codeplex.com/" target="_blank">SQL Server Hosting Toolkit</a>, up on CodePlex.</p>
<p>So now we can do wonderful things like this from the command line:</p>
<pre>SqlPubWiz.exe script -d DBNAME -S SERVERNAME c:\db-schema.sql -schemaonly</pre>
<p>and</p>
<pre>SqlPubWiz.exe script -d DBNAME -S SERVERNAME c:\db-data.sql -dataonly</pre>
<p>For the data extract, it actually uses an intelligent ordering, and produces SQL that generally &#8216;just works&#8217;, even with complex foreign key constraints.</p>
<p>There are other options as well if you want to control it to a greater degree.</p>
<p>This is close enough to mysqldump that it makes me quite happy, and even has a simpler syntax (though fewer options).  Also note that this isn&#8217;t really ideal for very large databases.  SSIS, bcp and other tools are a better choice in that scenario.</p>
<p>Do you have tools you like better?  Let me know in the comments.</p>
<p><span>Andrew Hollamon</span><br />
<span>D&#8217;Mention Systems, LLC</span></p>
<p><span>Follow my other blog at:<br />
</span><a href="http://dmentionsystems.com/blogs/andrew">http://dmentionsystems.com/blogs/andrew</a></p>
<p><span>Follow my business partner Mike&#8217;s blog at:<br />
</span><a href="http://dmentionsystems.com/blogs/mike/">http://dmentionsystems.com/blogs/mike/</a><br />
<span><br />
</span><span style="font-family: Verdana">Are you looking for database or software experts to help you with your software project?  Or need to integrate multiple systems or databases?</span></p>
<p><span><a href="http://dmwebzing.com/contact_us.php">Contact us here for a free consultation</a>.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://dmentionsystems.com/blogs/dmtechzing/2009/08/19/mysqldump-equivalent-for-microsoft-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
