Easier way to "Run Selection"

stevelong's profile image stevelong posted 2 weeks ago in Running SQL scripts Permalink

Not sure if this is a "Feature Request" or an "Enhancement Request" so I figured I'd just post it here...

Over the years, several users have requested a selection-dependent execution option similar to SSMS: /forum.php?t=27273, /forum.php?t=16048, /forum.php?t=12646, /forum.php?t=9266

I'd like to add my vote for this feature as well.

When using a single window/file to save related queries, I frequently do NOT want to execute the whole query window (doing so could potentially be disastrous, especially in a database that auto-commits every transaction by default). I feel that defaulting to "Run Selection" is safer.

I use the mouse to select the lines that I want to run, and would like a single-click option to run those lines. As it stands, I must make two clicks (either right-click then Run Selection, or click Query menu then Run Selection, or click the dropdown menu next to the Run button on the toolbar then Run Selection). Many modern toolbar interfaces with a combo select button will remember the last-used selection and that becomes the default behavior for the next single-click on the button; that feature would be useful here.

ansgar's profile image ansgar posted 1 week ago Permalink

What about using a keyboard shortcut instead of the mouse?

ansgar's profile image ansgar posted 1 week ago Permalink

Of course mouse usage should be intuitive too, so please do not misinterprete my keyboard comment.

In SSMS the "Execute" button does not have a dropdown menu. The button just magically executes the selection if available. Without a selection, all text is executed. I would not directly compare that with HeidiSQL which provides a drop-down menu with explicitly labelled options:

grafik.png

grafik.png

ansgar's profile image ansgar posted 1 week ago Permalink

Oracle SQL developer has two buttons. First one runs the currently focused query, second one the whole script:

grafik.png

Different SQL tools don’t all use the same “Run” button logic. In SSMS, the Execute button (or F5) runs the selected text, or if nothing is selected it runs the whole batch. HeidiSQL goes a step further and gives that button a dropdown so you can choose whether it should apply to the current query, the selection, or the full script. DBeaver works againt differently: it has separate commands instead of one button that changes behavior.

Please login to leave a reply, or register at first.