FogBugz will create its own schema if pointed at an empty database with one table in it:
CREATE TABLE Version (ixVersion int)
If FogBugz is pointed at such a database it will create all the necessary tables and fill them with default data.
Sometimes (particulary when you want to copy data into this table) you just want the schema and not all of the default rows that FogBugz needs to run (for instance default users, projects, areas, etc).
If your tables are not owned by ‘dbo’ when you move your FogBugz database you may find that the tables cannot be seen because of security restrictions.
You may also be able to use the following code:
SELECT 'EXEC(''sp_changeobjectowner @objname = '''''+ ltrim(u.name)+'.'+ ltrim(s.name)+''''''<br /> +', @newowner = dbo'')' FROM sysobjects s, sysusers u WHERE s.uid = u.uid AND u.name <>'dbo' AND xtype in('V','P','U') AND u.name not like 'INFORMATION%' order by s.name
For MySQL, here’s a script that will spit out truncate statements for all tables in a given database:
SET @new_database ='fogbugz1'; SELECT CONCAT( "SELECT '",TABLE_NAME,"'; ", " TRUNCATE ",@new_database,".", TABLE_NAME,";") AS Statement FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = @new_database GROUP BY TABLE_NAME