A query tab can hold one statement or a whole script. Two actions run them:
- "Execute" runs one statement: the selection when there is one, and otherwise the statement the cursor is in.
- "Execute All" runs every statement in the tab, one after another, in the order they appear.
A selection is run exactly as selected, also when it holds several statements. "Select Current Statement" in the "Selection" menu shows which statement "Execute" would take.
## Where a Statement Ends
Statements are separated by a line which holds nothing, or which holds only `go`, or which holds only `/`. A semicolon does not separate statements; a semicolon at the end of the last line of a statement is removed before the statement is sent, unless that line ends in `end;`, which belongs to [[Procedural SQL]].
So the following text holds two statements:
```sql
select code
, description
from ItemsIncremental
select count(*)
from ItemsIncremental
```
whereas the same text without the empty line in the middle is one statement and will not run.
## Client-side Statements
Statements of [[Invantive Script]] which run on the device itself, such as `local export results`, are recognised as such and handled by the product instead of being sent to the platform. They are reported in the messages as a local statement with the time they took. `local exit` closes the window.
## While a Statement Runs
The bar above the editor reports what the engine is doing and how long the statement has been running, refreshed twice a second. The row count and the duration are reported on the status bar and in the messages as soon as the statement is finished. "Execute All" reports every statement separately and the total afterwards, and stops at the first statement that fails.
The button in that bar cancels. Cancelling does not interrupt the statement: the platform finishes the work, and the result is discarded as soon as it arrives. With "Execute All" the statements that have not started yet are dropped.
A statement that fails writes the full error in the messages and opens a window with the message, the message code and the topics about that code on the product forums.