SqlDbx Forum

SqlDbx

You are not logged in.

#1 2019-10-27 13:05:17

TimD
Member

Script Fragments - Retain Variable Values for Future Runs

Is there a way to execute a ‘script fragment’ with variables and retain the values entered into the variables so they show up the next time you run the script (giving you the option to change them if necessary)? I love this feature of SqlDbx, and it would be great if I didn’t have to type or even copy/paste several long strings into each variable that I have defined for each and every future run of that script. Thanks for your help.

Offline

#2 2019-10-27 13:08:25

TimD
Member

Re: Script Fragments - Retain Variable Values for Future Runs

Btw, I'm running version 6.02 Professional on MS SQL Server 17 if that helps.

Offline

#3 2019-10-30 08:05:48

sqldbxhelp
Administrator

Re: Script Fragments - Retain Variable Values for Future Runs

They are preserved between runs. They are reset only if you define them again.
Here's the example.

$define symbol  = CHAR

select * from some_table where symbol = $(symbol)  -- First time you run it it will ask you for the value. Next time it will use the same value

$define symbol -- This will reset and next time you run query above you will be asked for the value again.

Offline

#4 2019-10-30 15:07:25

TimD
Member

Re: Script Fragments - Retain Variable Values for Future Runs

Thank you!

Can you also tell me why the combo box does NOT show up on a toolbar when I either run a fragment or when I load my fragment script?  I had this in ver. 5.11?

Offline

#5 2019-10-30 20:09:03

sqldbxhelp
Administrator

Re: Script Fragments - Retain Variable Values for Future Runs

The open and end markers changed slightly
-- {{ name
-- }}

Space between - and { or } is required now

Offline

Board footer

Powered by FluxBB