Shift-F5: ignore other syntax errors
Current behaviour: let's say we're editing a multi-statement script. The cursor is in the middle of one of the statements. Some other statements in the script are broken (i.e. have invalid syntax) but the one under the cursor is perfectly valid. We hit Shift-F5, expecting the current statement to be executed. Instead, we get a syntax error on some other piece of the script half a mile down the screen.
Expected behavior: just run whatever is under the cursor and ignore all other parts of the script.
Brian Cunningham commented
I can understand why a broken SQL statement would cause this feature problems, especially if you're asking SQL Server to parse the SQL. I would like to offer a suggestion.
If there's a SQL error, require us to separate our SQL statements with semicolons. This should make the feature very easy to implement since it is just start at the cursor, go backwards until BOF or a semicolon, go forward until EOF or a semicolon, execute what's in the middle.
Since I'm coming back to SQL Prompt after being in the Oracle world for the past nine years, I've gotten used to ending all of my statements with a semicolon. However, I don't think I'm the only one that bears Oracle scars and would appreciate this feature.
P.S. If you're in the mood to steal features, another feature that Toad for Oracle has is to run the "snippet at cursor" where "snippet at cursor" is defined as "non-blank lines with blank lines before and after."
This is something I've always struggled with. Many a time I write many quick, small sql queries, especially when testing, and sometimes the queries are broken for many reasons. I don't understand why one broken query should prevent running another one that is perfectly valid... Maybe there is a reason but would it not be possible to actually relax this condition to let me run the valid query? This would be so helpful.