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

#6 2020-01-22 18:37:29

TimD
Member

Re: Script Fragments - Retain Variable Values for Future Runs

Thank you for your last response. That solved my problem.

Regarding the length of my fragment scripts...I'm having an issue with fragment script that are over 1,000 lines. If it's over 1,000 lines, the application freezes up if I try to scroll down to the bottom. Anything less than a 1,000 lines and I don't have any issues. Is it true there's a limit, or is this a bug? (version 6.02 Professional on MS SQL Server 17). Thank you.

Offline

#7 2020-01-22 20:23:29

sqldbxhelp
Administrator

Re: Script Fragments - Retain Variable Values for Future Runs

There's no limit on size of named script fragment and so far not able to reproduce this issue.

Offline

Board footer

Powered by FluxBB