SQL Workbench
Query data with the SQL Workbench
Query Business Central tables with SQL in the SQL Workbench, simulate INSERT, UPDATE and DELETE first, export results to Excel and reuse saved statements.
updated: applies-to: 1.0.0.0
The SQL Workbench is Code Studio in SQL mode. It queries Business Central data with familiar SQL and shows the answer in a grid.
Open it
Choose the SQL Workbench tile, SQL Workbench in the Code menu, or SQL at the top of Code Studio.
Run a query
- Type a statement, or pick one from Samples, such as Top 10 customers by balance.
- Choose Run (F5).
- Read the result in the grid. The summary line shows the row count and the time it took.
Table and field names with spaces or dots go in square brackets, for example [Sales Header] and [No.]. See the SQL syntax reference.
Change data safely
INSERT, UPDATE and DELETE are allowed for users with write access. Choose Simulate first: it reports how many rows would be affected, and nothing is saved. Every write goes through the same Security Guard and audit log as every other tool.
Export and reuse
- Export to Excel downloads the result.
- Save and Save As keep a statement under a name; Load opens it again. The SQL Statements page lists them.
- SQL History lists the statements you ran, with their outcome and row count.
TIP
Results are capped at the SQL Max Rows set in Studio Setup. Use TOP, OFFSET and FETCH, or a WHERE filter, to see the others.