How do I reset the value for a generator?

By: Borland Staff

Abstract: SET GENERATOR my_gen_id TO 0

Problem:
How do I reset the value for a generator?.

Solution:
Assume that you have already created a generator in
your database as:
		
CREATE GENERATOR my_gen_id;

NOTE:	The default value of a generator when created is
	(0) zero.  When you use the generator the first
	value assigned to your primary key will depend on
	the increment value that you assign in your trigger.
				
	Example:
	
	SET GENERATOR my_gen_id TO n;
		
	Where (n) = the new assigned value.

note:  You cannot reset the value of the generator inside of 
           a trigger or stored procedure.  You can use the gen_id()
           function to increment the value in a generator.    The SET
           GENERATOR command will only work outside of a stored
           procedure or generator.

Server Response from: ETNASC04