|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Move Records :( very big problems
I have create Table and Generator, which was needed for keeping sequence. I have noticed that in this table I will store data group by JobList (joblist is a indentity for each group, only one group will be show to user, and operate on) how can I move records (RecUp/Down or RecTop/Bottom) i decided to use changing Generator Value *, but each joblist can be created by user, and new Recrods can be inserted not always one by one**, so my algortihm failed ... any ideas ??
Best Regards *) rec_1 move betwen rec_2 and rec_3 GeneratorValue_rec_1 = GeneratorValue_rec_2 + GeneratorValue_rec_3 - GeneratorValue_rec_2) /2 **) Joblist_1 GeneratorValue Joblist_1 GeneratorValue Joblist_1 GeneratorValue Joblist_2 GeneratorValue Joblist_2 GeneratorValue Joblist_2 GeneratorValue Joblist_1 GeneratorValue |
|
#2
|
||||
|
||||
|
I'm not quite sure what you mean my "moving the records".
I suppose that you want to keep the generates ID's in sequence (Ex: 1,2,3,4,5,6 ..., n) but you are getting values like (1,2,3,5,6,8, ... n). There are several posibilities to solve this problem: 1) updating the ID's to the corect one's (Ex: UPDATE TABLE SET ID=ID-1 WHERE ID BETWEEN X AND Y) 2) to keep this from happening again I sugest a trigger that puts the correct ID (AFTER the INSERT and not BEFORE) to make sure that the user commited the transaction and did not changed his mind about inserting a new row. Am I making any sense to you ?? Good luck, SilverDB |
![]() |
| Viewing: Dev Shed Forums > Databases > Firebird SQL Development > Move Records :( very big problems |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|