Ctrl+T opens a query tab. It belongs to one connection for its lifetime, and the toolbar carries
that connection's name and colour.
A tab keeps running against the connection it was opened with however the tree selection moves. A tab whose connection has been closed cannot run and says so, which is a different thing from Studio having no database open.
Writing
The editor highlights WitSQL, completes names, and underlines errors in the text as you type.
The message under the editor is the engine's, in the engine's words. Studio frames it and does not paraphrase it, so what you read is what the parser said and can be searched for.
Ctrl+Shift+F formats the statement.
Running
| Key | Runs |
|---|---|
F5 |
The statement under the cursor |
Ctrl+Shift+F5 |
The whole script |
Ctrl+Return |
The selection |
Escape |
Stops what is running |
F5 is the one to use while writing. A tab can hold a dozen half-finished statements and you can
still try the one you are on, without commenting anything out.
A script runs one statement at a time and each reports separately.
The four panels
They are always there, in this order, and each answers a different question.
Result is the rows. Row count and elapsed time sit in the footer.
Right-click gives you Copy, Copy with Headers, Copy as INSERT, Copy All Rows, Copy All as INSERT, and Export Results. Copy as INSERT is the one worth remembering: it turns a selection into statements you can paste into another database.
Messages is a line per statement of the script: its number, what it did, how long it took.
Plan is EXPLAIN without running the query.
The panel says so itself: the plan is built without executing anything, and this engine reports no row counts and no costs. What it answers is which access path was chosen, which is the question behind most queries that are slower than expected. See indexing.
History is what has been run, searchable.
History, and what is not in it
Query history is kept in a WitDatabase of Studio's own. Thirty days or five thousand entries, whichever comes first.
Connection strings and parameter values are never written to it. The statement text is, so the history is useful, and the things that would make a history file dangerous to hand to somebody are not.
Worth noticing what this means about the tool: Studio's own storage is the engine it inspects.
Find and replace
| Key | Does |
|---|---|
Ctrl+F |
Find |
Ctrl+H |
Replace |
F3 |
Next |
Shift+F3 |
Previous |
Escape |
Close the band |
One band per tab, because the term, the toggles and the place in the text all belong to the text being edited.
Transactions
A tab can hold a transaction open across several executions, with the isolation level set before it begins.
The tab is marked while a transaction is open and closing it asks first. An open transaction holds a write lock, so this is not a thing to leave and forget. See transactions.
Files
Ctrl+S saves the tab to a .sql file, Ctrl+Shift+S saves it as a new one, and a modified tab
is marked. Ctrl+W closes a tab and Ctrl+Shift+T brings back the last one closed.
Tabs can be pinned, which keeps them out of the way of Ctrl+W.
Where to go next
- Data and editing, what the Result panel can do
- Import and export, where Export Results leads
- WitSQL, the language
- Settings and shortcuts, the full keyboard map