Contents
- Overview
- Solution
- Related Symptoms
- Support Scope & Product Constraints
- Verification Checklist
- Frequently Asked Questions
Overview
If you attempt to bulk-export FogBugz case data to JSON directly from Microsoft SQL Server using FOR JSON PATH / JSON_QUERY and receive errors like “Incorrect syntax near 'JSON'” or “Incorrect syntax near 'WITHOUT_ARRAY_WRAPPER',” your SQL Server version does not support native JSON output (supported starting with SQL Server 2016).
For FogBugz FYS 8.8.55 decommissioning while keeping historical data searchable (case descriptions, comments, and attachment filenames/metadata), the reliable approach is to take an authoritative full SQL Server .bak backup and restore it onto a separate SQL Server 2016+ instance to perform fast bulk JSON exports for indexing into Elasticsearch/OpenSearch.
Solution
Scenario
You want to decommission an on-prem FogBugz FYS 8.8.55 instance but keep historical cases searchable (primarily case text + comments + attachment filenames/metadata). REST API extraction (for example, Python + REST API exports) may be too slow or unreliable for bulk archival.
How to recognize the SQL Server JSON export issue
When running JSON export queries in SQL Server, you may receive errors such as:
[S0001][102] Line X: Incorrect syntax near 'WITHOUT_ARRAY_WRAPPER'.[S0001][102] Line Y: Incorrect syntax near 'JSON'.
Root cause
SQL Server native JSON features (FOR JSON PATH, JSON_QUERY, WITHOUT_ARRAY_WRAPPER) are available starting SQL Server 2016. If your FogBugz database is hosted on an older SQL Server version, JSON export queries will fail with syntax errors. This is a SQL Server version/feature limitation rather than a FogBugz-specific JSON export feature.
1) Create an authoritative archive: full SQL Server backup (.bak)
This preserves everything in one artifact you can restore later (including attachments stored in the database).
SSMS steps
- Open SQL Server Management Studio (SSMS) and connect to the SQL Server hosting the FogBugz database.
- Locate the FogBugz database (name varies by installation).
- Right-click the database → Tasks → Back Up…
- Backup type: Full
- Destination: Disk → choose a path with sufficient free space.
- Run the backup and confirm it completes successfully.
- Strongly recommended: do a test restore to another SQL Server instance before decommissioning.
T-SQL template
BACKUP DATABASE [<FOGBUGZ_DB_NAME>]
TO DISK = 'D:\Backups\<FOGBUGZ_DB_NAME>_FULL.bak'
WITH COPY_ONLY, COMPRESSION, INIT, STATS = 10;
2) Export JSON in bulk (fast) by restoring the .bak to SQL Server 2016+
If your production SQL Server is older than 2016, avoid changing it. Instead:
- Take the
.bakbackup (Step 1). - Restore it onto a separate machine/VM running SQL Server 2016+ (can be temporary).
- Run bulk JSON export queries against the restored copy.
- Load the resulting “one document per case” JSON into Elasticsearch/OpenSearch.
This avoids REST overhead and avoids modifying a fragile/end-of-life production environment beyond creating the backup.
3) If you cannot use SQL Server 2016+: export relational rows and assemble JSON externally
If restoring to SQL Server 2016+ isn’t possible:
- Export core tables (commonly
Bug,BugEvent,Attachmentmetadata) to CSV/TSV. - Assemble nested JSON outside SQL Server (ETL/script) to create one document per case (events/comments as a nested array; attachments metadata as a nested array).
- Alternative: use
FOR XMLon older SQL Server and convert XML → JSON afterward.
4) If the FogBugz schema viewer URL returns 404, validate schema directly in SQL Server
If https://<your_fogbugz_url>/f/page?pg=pgSchema returns a 404, the schema viewer path may vary by deployment/version or be disabled. Validate schema directly via SQL Server system catalog queries instead.
Confirm key tables exist
SELECT name
FROM sys.tables
WHERE name IN ('Bug','BugEvent','Attachment')
ORDER BY name;
Inspect columns for a table
SELECT c.name, t.name AS type_name
FROM sys.columns c
JOIN sys.types t ON c.user_type_id = t.user_type_id
WHERE c.object_id = OBJECT_ID('dbo.<TABLE_NAME>')
ORDER BY c.column_id;
5) Installer access (FogBugz FYS 8.8.55)
FogBugz FYS installer downloads may be license-gated (no public download link). If you need the installer:
- Provide proof of entitlement (for example, an order/license reference like
<order_id>). - Retrieve the installer via an authenticated transfer method (commonly SFTP) using a client such as FileZilla:
- Host:
sftp://<sftp_host> - Username:
<sftp_username> - Password:
<sftp_password>
- Host:
- Note: SFTP cannot be accessed in a web browser; credentials are typically time-bound and should be treated as secrets.
Support Scope & Product Constraints
- FogBugz FYS is end-of-life.
- Database migration/conversion efforts (including export/ETL conversion work) are outside standard support scope.
- FogBugz FYS does not include a built-in mechanism to convert an existing MS SQL Server–backed deployment to MySQL. Any MS SQL Server → MySQL conversion would be a custom, customer-owned migration (schema mapping, transformation, validation).
- For decommissioning plus a searchable archive, the recommended low-risk approach is to keep an authoritative SQL
.bakand restore it to SQL Server 2016+ for bulk export, rather than changing database backends.
Verification Checklist
- The
.bakbackup completes successfully and can be restored on a separate SQL Server instance. - On SQL Server 2016+, a test
FOR JSONquery runs without syntax errors. - The exported JSON includes:
- Case fields (from
Bug) - Event/comment history (from
BugEvent) - Attachment metadata (for example, filename, IDs; excluding binary/blob fields to keep exports manageable)
- Case fields (from
- Sample documents load into Elasticsearch/OpenSearch and are searchable by case title/description/comments and attachment filenames.
Frequently Asked Questions
- 1. How can I tell if my SQL Server supports
FOR JSON PATH/JSON_QUERY? - If queries using
FOR JSON PATH,JSON_QUERY, orWITHOUT_ARRAY_WRAPPERfail with errors like “Incorrect syntax near 'JSON'” or “Incorrect syntax near 'WITHOUT_ARRAY_WRAPPER',” your SQL Server is older than 2016 and does not support native JSON output. - 2. The schema viewer page
https://your_instance.domain.com/f/page?pg=pgSchemareturns 404. What should I do? - The schema viewer path can vary by deployment/version or be disabled. Use SQL Server system catalog queries (
sys.tables,sys.columns) to confirm FogBugz table and column names directly in the database. - 3. What’s the safest way to decommission FogBugz but keep all data recoverable?
- Create a full SQL Server
.bakbackup and perform a test restore on another SQL Server instance. Keep the.bakas the authoritative archive even if you also export data for Elasticsearch. - 4. I want Elasticsearch indexing, but my FogBugz database server is old and fragile. Do I need to upgrade it in place?
- No. Take a
.bakbackup and restore it onto a separate SQL Server 2016+ instance (a temporary VM is fine) to run bulk JSON exports there. This avoids changing the original environment. - 5. Can FogBugz convert my existing MS SQL Server database to MySQL so I can use the MySQL option in the installer?
- FogBugz FYS does not include a built-in MS SQL Server → MySQL conversion mechanism. Any conversion would be a custom, customer-owned migration effort (schema mapping, transformation, validation) and is not supported/provided as tooling.
- 6. Where do I download the FogBugz FYS 8.8.55 installer?
- The installer may be license-gated and not publicly downloadable. After entitlement verification, it can be provided via an authenticated transfer method (commonly SFTP). Use an SFTP client (not a browser) and request access through the support portal.
Priyanka Bhotika
Comments