Right-click a cell value and run a predefined parameterized query
1. right-click one or multiple "cells" in a column of the datasheet (result of query or table content), and
2. have a "Quick Query" context menu item, listing in a submenu several predefined queries (defined upfront elsewhere i.e. under preferences)
3. that would pop up a dialog showing the query result
This would be very useful for easy lookups or testing potential joins, and gain quicker understanding of the dataset.
Building several queries for this is just cumbersome.
That would be a great differentiator (as is 'Quick Filter') vs e.g. TOAD Data Point (my favorite SQL builder).
- Say that you define under preferences one or multiple parameterized query statements e.g. SELECT * FROM HDR WHERE DOC IN (%1)
- then when you go on any resultset (from Query or Data tab), and you right-click on a cell/value, you would get the option to run the predefined subquery of your choice (defined in step 1) using the selected value from the cell as parameter e.g. cell/value is 180033 -> right-click and choose a defined subq which would run SELECT * FROM HDR WHERE DOC IN (180033). As HS knows the data type of the selected value, it would know to include quotes if applicable.
- the resultset of that subquery would display in a new window (not a full new HS instance).
As for the same but applied to multiple cells, I realize HS does not allow to select multiple cells in the datasheet. If it could, the subquery would receive as parameter the values separated by comma e.g. I select cells where values are 3, 6 and 98 --> the subq would run like SELECT * FROM HDR WHERE DOC IN (3,6,98).
Hope this makes sense.
HeidiSQL has snippets, HeidiSQL can run parametrized queries and HeidiSQL has query tabs. Perhaps we can combine these things: Store some snippet which has this filecontent:
SELECT * FROM mytable WHERE id IN (:someparam)
Then, browse a table and rightclick a value like you described, which opens a submenu with all available snippets which have some parameter in it. Clicking on one snippet in that submenu would open up a new query tab with the parametrized snippet.
That would work well ! Ideally the new query tab would execute automatically (saves a F9), or that behavior could be control in the preferences.
The functionality would be very useful in data exploration where one goes from one table to the next and use the snippets to look up some information in known tables.
Please login to leave a reply, or register at first.