'Format sql to classic asp in VSCode

I use the extension in VSCode to compose SQL queries and try them out.

Is there a way to then format the queries to be included in the source? I'm using classic asp, so Im doing something like

    sql = ("select felt1,felt2 " &_
    " from tabel " &_
    " where ditten=datten " &_
    " order by noget")

In Classic asp a string can't continue across lines without continuation characters, so

    sql = "select felt1, felt2
    from tabel ...
    order by xyzzy" 

is not allowed.

This is just tedious, when I want the query to be somewhat readable in the code. Is there a macro, an extension or something to make that easier?

The ability to go the other way would be nice too.



Solution 1:[1]

It's pretty simple just like this: Use the & symbol to combine the string and extend it.

string = "string contains this stuff"
string = string & "new line"
string = string & "new line etc"

I don't know if you have access to the Mysql server directly, but if you do, might install MS Workbench on it, a much better more direct way to test MYSQL code if you have that as an option. Did I mention its free and better than phpadmin?

UPDATE - after your edit I see that you seem to know how to do what I explained, so if you want an EZ way to do MYSQL trust me when I say get Workbench, it has everything you could ever want for this. Also once you have this, then you can make stored procedures with EASE and eliminate SQL Injectable code like what you are using, I understand you want to make it "easy to change" but that means ANYONE can do that with good or bad intentions, you are better off using a stored procedure even a dynamic one if you can get away with it.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1