View previous topic :: View next topic
|
Author |
Message |
sri_mf
Active User
Joined: 31 Aug 2006 Posts: 218 Location: India
|
|
|
|
I have a table called EMP which contains No and Name.
No
1
2
3
4
5
6
7
8
If i delete the 4th records other are rearranged such that result is
1
2
3
4
5
6
7
Can anyone throw some suggestion on this. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
the question might be clear to You, but for us is confusing...
there is no fourth record in a db2 table
but
/mind reading on
maybe what you meant is that
You want to delete the row with a key of 4
shift all the other records up/down one position
/mind reading off
in any other case You showed only that the row wit a key of 8 has been deleted |
|
Back to top |
|
|
sri_mf
Active User
Joined: 31 Aug 2006 Posts: 218 Location: India
|
|
|
|
enrico-sorichetti wrote: |
the question might be clear to You, but for us is confusing...
there is no fourth record in a db2 table
but
/mind reading on
maybe what you meant is that
You want to delete the row with a key of 4
shift all the other records up/down one position
/mind reading off
in any other case You showed only that the row wit a key of 8 has been deleted |
Good Mind Reading Enrico . You are Correct.
Yes. If the forth record is deleted then the other records should be down by one. |
|
Back to top |
|
|
sri_mf
Active User
Joined: 31 Aug 2006 Posts: 218 Location: India
|
|
|
|
Any suggestions form DB2 Experts Pls. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Sri,
I could guess at what you want but, you need to supply a few more details.
But then I am not a db2 expert, so maybe that is where the problem lays. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
If the forth record is deleted then the other records should be down by one. |
Why do you believe this should happen? Is this not the primary key for the data? What about other informatoin in the system that relates to the "No"?
A "No" might be deleted, but i believe there are potential problems if the key values greater the deleted key are "moved up".
There may also be issues with multiple users . . . |
|
Back to top |
|
|
sri_mf
Active User
Joined: 31 Aug 2006 Posts: 218 Location: India
|
|
|
|
It is a scenario given to me to get the ways of doing it.I am sure of its future usage.Thanks to every one. |
|
Back to top |
|
|
|