Integration · SQL Server · T-SQL · Azure SQL
Generate SQL Server test data, with foreign keys intact
Multi-table fixtures that load with
BULK INSERT and
import_sqlserver.sql. Free web sessions.
Short answer
Design a multi-table schema in SynthForge, generate, and download the SQL Server export.
You get import_sqlserver.sql (CREATE TABLE with FKs plus
BULK INSERT) and per-table CSVs. Every child row references a real
parent by construction. Rewrite FROM 'csv/…' to absolute paths the
server can read, then run with sqlcmd.
Why generate rather than hand-roll
.NET teams, SSIS packages, and enterprise staging still need multi-table seed data that respects foreign keys. Hand-written INSERT scripts and half-empty CSVs waste more time than the features they unblock.
SynthForge sorts tables by dependency, generates parents first, and samples FKs from IDs that exist. The same schema exports to Postgres, MySQL, or Cockroach when your org runs mixed engines.
How to do it
1. Define the schema
Describe tables in plain English, build them in the visual editor, or paste CREATE TABLE DDL. AI forge and SQL import both produce multi-table schemas with single-column foreign keys.
2. Set cardinality (optional)
Use relationship ratios such as "1 to 4 orders per customer" instead of inventing every child row count. Parents generate first; child foreign keys are sampled from real parent IDs.
3. Generate and export SQL Server
Pick SQL Server as the SQL dialect (or include SQL export in formats). The download ZIP contains import_sqlserver.sql (CREATE TABLE with FKs plus BULK INSERT loaders) and csv/<table>.csv data files. Identifiers use [brackets]; strings use NVARCHAR.
4. Rewrite CSV paths to absolute, then load
SQL Server BULK INSERT does not resolve relative paths the way psql or mysql do. The export uses FROM 'csv/<table>.csv' so the bundle stays portable; rewrite those paths to a location the SQL Server process can read, then run the script with sqlcmd (SQL Server 2017+ for FORMAT = 'CSV').
# Extract the ZIP, then rewrite relative paths to absolute ones
# the SQL Server service account can read:
cd /path/to/extracted-bundle
sed -i "s|FROM 'csv/|FROM '$(pwd)/csv/|g" import_sqlserver.sql
# Create a database (once), then import
sqlcmd -S localhost -U sa -P 'YourStrong!Pass' -Q "CREATE DATABASE myapp_staging;"
sqlcmd -S localhost -U sa -P 'YourStrong!Pass' -d myapp_staging -b -i import_sqlserver.sql
# Loaders look like (after rewrite):
# BULK INSERT [customers]
# FROM '/path/to/extracted-bundle/csv/customers.csv'
# WITH (FORMAT = 'CSV', FIRSTROW = 2, FIELDTERMINATOR = ',',
# ROWTERMINATOR = '0x0a', TABLOCK); 5. Docker / Azure SQL notes
In Docker, copy the bundle into a path owned by the mssql user (for example /var/opt/mssql/load) - bind-mounting a 0700 host temp dir often fails with permission denied for uid 10001. Azure SQL Database does not support BULK INSERT from arbitrary client paths the same way; use bcp, Azure Blob + BULK INSERT FROM URL, or load via a jump box / container that can see the files.
# Example: load into a local SQL Server container
docker cp . sf-mssql:/var/opt/mssql/load
docker exec -u 0 sf-mssql chown -R mssql:mssql /var/opt/mssql/load
# Rewrite FROM 'csv/…' → FROM '/var/opt/mssql/load/csv/…' inside the script
docker exec sf-mssql /opt/mssql-tools18/bin/sqlcmd \
-S localhost -U sa -P 'YourStrong!Pass' -C \
-d myapp_staging -b -i /var/opt/mssql/load/import_sqlserver.sql 6. (Optional) Agent path
With an API key and hosted MCP, agents can run description_to_dataset, download the ZIP, rewrite paths, and load with the same import_sqlserver.sql. First API key includes 10 free credits; web sessions stay free.
# MCP endpoint: https://mcp.synthforge.io/mcp
# Auth: Authorization: Bearer sfk_live_…
# Docs: https://synthforge.io/docs/mcp Frequently asked questions
Why absolute paths for BULK INSERT?
Does SQL Server enforce the foreign keys?
FORMAT = 'CSV' - which SQL Server versions?
How large a dataset can I generate?
Can I use the same schema for Postgres or MySQL?
Does SynthForge use my real production data?
Related
Ready to seed SQL Server staging?
Generate multi-table SQL Server data with real foreign keys, rewrite paths once, load with sqlcmd. No credit card for the web app.