1.4 KiB
1.4 KiB
SQL File Execution
SQL File Execution lets you run .sql files directly within DBX, with progress tracking and the ability to cancel mid-execution. This is useful for running migration scripts, seed data, or database setup files.
Running a SQL File
- Open the SQL File Execution panel.
- Select a
.sqlfile from your filesystem. - Choose the target connection and database.
- Click execute.
Progress Tracking
During execution, DBX displays:
- The total number of statements detected in the file
- How many statements have been executed so far
- The currently executing statement
This gives you visibility into long-running scripts without waiting blindly for completion.
Smart Statement Splitting
DBX parses the SQL file intelligently rather than naively splitting on semicolons. The parser correctly handles:
- Functions and procedures -- Multi-statement bodies with
BEGIN...ENDblocks are treated as a single unit. - Triggers --
CREATE TRIGGERstatements with embedded logic are kept intact. - Quoted strings -- Semicolons inside string literals or identifiers are not treated as statement delimiters.
This ensures that complex SQL files execute correctly without requiring manual editing.
Cancelling Execution
If you need to stop execution before the file finishes, click the cancel button. DBX will stop after the current statement completes. Statements that have already been executed are not rolled back.