Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to fix a broken generator (InterBase) Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
Fixing a broken generator (InterBase) 25-Aug-02
Category
Database Others
Language
Delphi 2.x
Views
69
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

Recently I got unique key violations during insert attempts on a piece of code that 
used to work (what can go bad, will go bad). I found that the offending field - was 
actually created by a generator. For some reason the generator returned values that 
where already in the database.

how can I display the current value of the generator?
how can I adjust the value of the generator?

Answer:

See the example (table name is SD_LOAD, generator name is GEN_SD_LOAD).

Note:

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

SELECT DISTINCT(GEN_ID(gen_sd_load, 0))FROM sd_load

set GENERATOR gen_sd_load to 2021819

			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC