Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 17th, 2005, 05:06 AM
calvados calvados is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 66 calvados User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 2 h 40 m 23 sec
Reputation Power: 4
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

Reply With Quote
  #2  
Old February 18th, 2005, 03:45 AM
SilverDB's Avatar
SilverDB SilverDB is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Location: Romania
Posts: 173 SilverDB User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 45 m 53 sec
Reputation Power: 4
Send a message via Yahoo to SilverDB
Lightbulb

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

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > Move Records :( very big problems


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway