How to change the value of the generator

I want to change the generator value in Delphi using Firebird 2.5. Statement: ALTER SEQUENCE GEN_NAME RESTART WITH value. I want the value not to be a number, but a variable or parameter: ALTER SEQUENCE GEN_TELAGENT_ID RESTART WITH val;where val gets another integer value that I don't know yet.

I hope I understand what I understand. Sorry for my not very good english. Thanks for answers.

+3
source share
1 answer

use the parameter, it should work with your preferred components.

myQuery.SQL.Text := 'alter sequence gen_telagent_id restart with :val';
myQuery.Params.ParamByName('val').AsInteger := val;
myQuery.ExecSQL();

Actual syntax may vary depending on the components you use to connect to Firebird.

+2
source

Source: https://habr.com/ru/post/1785228/


All Articles