How do I move from running FogBugz on MySQL to SQL Server? - FogBugz Knowledge Exchange most recent 30 from http://fogbugz.stackexchange.com 2013-05-21T23:25:29Z http://fogbugz.stackexchange.com/feeds/question/188 http://www.creativecommons.org/licenses/by-nc/2.5/rdf http://fogbugz.stackexchange.com/questions/188/how-do-i-move-from-running-fogbugz-on-mysql-to-sql-server How do I move from running FogBugz on MySQL to SQL Server? FogBugz FAQ 2009-10-08T20:35:28Z 2012-08-02T08:11:14Z <p>I'm running on MySQL now, but would like to run FogBugz on SQL Server 2008. How do I convert?</p> http://fogbugz.stackexchange.com/questions/188/how-do-i-move-from-running-fogbugz-on-mysql-to-sql-server/189#189 Answer by Rich Armstrong for How do I move from running FogBugz on MySQL to SQL Server? Rich Armstrong 2009-10-08T20:36:39Z 2009-10-08T20:36:39Z <p>We use <a href="http://www.easyfrom.net/" rel="nofollow">ESF Database Convert</a> to convert MySQL databases into SQL Server databases for loading into FogBugz On Demand. You should be able to do so for your local install, too.</p> http://fogbugz.stackexchange.com/questions/188/how-do-i-move-from-running-fogbugz-on-mysql-to-sql-server/1556#1556 Answer by adambox for How do I move from running FogBugz on MySQL to SQL Server? adambox 2010-01-21T19:59:36Z 2012-08-01T14:34:21Z <h1>Contact Fog Creek Support</h1> <p>The instructions below are a bit outdated. Please contact our support team at customer-service@fogcreek.com and we'd be happy to provide more detailed instructions for converting your database.</p> <hr> <p><em>NOTE: Previous version of this post included detailed instructions, but they've been removed since they were outdated and didn't always work. Please contact us and we'll work with you to provide more complete instructions.</em></p> http://fogbugz.stackexchange.com/questions/188/how-do-i-move-from-running-fogbugz-on-mysql-to-sql-server/5978#5978 Answer by scoarescoare for How do I move from running FogBugz on MySQL to SQL Server? scoarescoare 2010-11-19T00:30:31Z 2012-08-02T08:11:14Z <p>We had the following configuration:</p> <ul> <li>MySQL</li> <li>IIS </li> <li>LDAP Authentication (Active Directory)</li> </ul> <p>Here's how we just did it:</p> <ol> <li>Run the FogBugz setup and create a brand new database</li> <li>Use Microsoft SQL Server Migration Assistant 2005 for MySQL or create a sql dump to get the DDL of your plugin tables.</li> <li>Download the MySQL ODBC and install it on the new SQL Server.</li> <li>Create a linked server to the MySQL database. <a href="http://www.packtpub.com/article/mysql-linked-server-on-sql-server-2008" rel="nofollow">http://www.packtpub.com/article/mysql-linked-server-on-sql-server-2008</a></li> <li>Run create and run these stored procs:</li> </ol> <p>&zwnj;</p> <pre><code>SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO Create PROCEDURE [dbo].[CopyFogBugzData] @TABLE NVARCHAR(MAX) AS BEGIN DECLARE @sqlCommand nvarchar(max) DECLARE @columnList nvarchar(max) print @Table IF (select count(*) from openquery(fogbugz,'SHOW TABLES FROM `fogbugz`')where tables_in_fogbugz = @Table) &lt; 1 BEGIN PRINT @Table + ' does not exist in source db'; RETURN -1 END SET @ColumnList = REPLACE( ( SELECT Column_Name AS [data()] FROM information_schema.columns WHERE table_name = @table FOR XML PATH ('') ), ' ', ',') SET @sqlCommand = N'TRUNCATE TABLE ' + @Table + ' '; if OBJECTPROPERTY(object_id(@table), 'TableHasIdentity') = 1 BEGIN SET @sqlCommand = @sqlCommand + N'SET IDENTITY_INSERT ' + @Table + N' on; ' --id and version table is not auto identity END SET @sqlCommand = @sqlcommand + N' INSERT INTO ' + @Table + N' (' + @columnList + N') ' SET @sqlCommand = @sqlcommand + N' SELECT ' + @columnList + N' FROM openquery(fogbugz,''select * from ' + @Table + N''');' if OBJECTPROPERTY(object_id(@table), 'TableHasIdentity') = 1 BEGIN SET @sqlCommand = @sqlcommand + N' SET IDENTITY_INSERT ' + @Table + N' off; ' END print @sqlcommand; EXECUTE (@sqlcommand) END SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[CopyALLFogBugzData] AS BEGIN exec sp_MSforeachtable 'DECLARE @Table NVARCHAR(255); Set @Table = (SUBSTRING(''?'',8, LEN(''?'') - 8)); exec CopyFogBugzData @Table' END GO </code></pre> <p>These procs will iterate over every table in your new fogbugz database. If this table exists in the source db in MySQL, it'll truncate the destination table and insert the data.</p>