Page 1 of 1

SQL Scripts with Variables?

PostPosted: Tue Nov 19, 2019 1:18 am
by danlapp
I've been using DBF Commander with multi-line single commands, by highlighting the code and clicking Execute.

Is there a way to create a script with multiple commands, including the use of variables?

For example:

set ItemStart = "ABC"
set ItemEnd = "RST"
select * from "C:\filename"
where ItemNumber > ItemStart and ItemNumber < ItemEnd
order by itemNumber

Thanks!

Re: SQL Scripts with Variables?

PostPosted: Tue Nov 19, 2019 8:20 am
by Admin
Hello,
unfortunately, there is no way to use variables in your SQL text, since variable definition is not an SQL statement.
But you can use a script file with multiple commands. Write your SQL in a text file, then open it by clicking Open button at the SQL Panel toolbar. Then, click Execute (F5) to run the whole script.
You can also use the script in batch mode. More info is available here:
http://dbf-software.com/sql-dbf.html
http://dbf-software.com/dbf-command-line.html