A document holds one statement or a hundred, separated by semicolons. Two buttons on the "General" tab of the ribbon run them: "Execute" runs the statement the cursor is in, "Execute All" runs every statement in the document from top to bottom. Both put their rows in the [[Invantive Query Tool/Results|Results]] panel and their entry in [[Invantive Query Tool/History|History]]. ## One Statement or the Whole Document "Execute" needs no selection: the statement the cursor is in is the one that runs, so moving the cursor into another statement and pressing it again runs that one. Where text is selected, the selection is what runs, which is how one line of a longer statement is tried on its own. "Execute All" runs the statements one after another and stops at the first which fails. What ran before it stands: a script is not a transaction, and the statements which succeeded have done whatever they do. When the run ends, a window states what happened - how long one statement took, or how many statements were executed and how many of them failed. The same figures stay readable afterwards in "History". ## What a Run Is Allowed to Do Running a whole document is licensed apart from running one statement. From release 27.0 onwards "Execute All" needs a licence which covers the function `itgen_querytool_execute_script`, where "Execute" needs `itgen_querytool_execute`. A licence without it leaves the button in the ribbon and stops the run with a message naming the function to acquire. On a connection to an Invantive repository the function must be granted to the user as well, as every function of such a repository is. The statements handed over on the command line run as a script too and need the same function; see [[Invantive Query Tool/Command Line Options|Command Line Options]] and [[Licensing]]. ## While It Runs The [[Invantive Query Tool/Progress|Progress]] panel draws what the statement is doing while it does it, and the dot at the right-hand end of the ribbon states how much of the recent past was spent waiting on the platform; clicking it opens the [[Invantive Query Tool/Connection Monitor|Connection Monitor]], which lists the calls themselves. From release 27.0 onwards the tab of the document itself shows that its statement runs: an open ring turns around the "Execute" triangle in place of the picture of the document until the statement ends, on a selected tab and on one left behind alike, so a run started in another document is seen without switching to it. See [[Invantive Query Tool/Main Window|Main Window]]. A statement which reads a large table is not read to the end before the first rows appear. The grid asks for more rows as it is scrolled, and the row count on the status bar is what has been read so far rather than what the table holds. ## Which Database It Runs Against Every statement runs against the database named on the connection button of the ribbon, as `<group>\<database>`, and against the partitions selected beside it. A statement naming a data container of that database - `select * from Projects@dummy` - runs against that container; a statement naming none runs against the default. Which containers a database has is decided in the [[Settings]] file.