| Author: Sri Harsha 05 Jul 2008 | Member Level: Silver | Rating: Points: 3 |
HI,
Write a "After" trigger with the update statement on the ID Column, So whenever the Deletion from the table happens the trigger fires and update the respective column.
|
| Author: Satyanarayan SushilKumar Bajoria 05 Jul 2008 | Member Level: Diamond | Rating: Points: 4 |
Hi,
You can use a After trigger in this scenario because in case of After trigger the data is first inserted into table and then copy into the magic table,so in magic table.
So whenever the Deletion from the table happens the trigger fires and update the respective column.
Thanks and Regards S.S.Bajoria
|
| Author: Mohd. Vaseem 05 Jul 2008 | Member Level: Silver | Rating: Points: 1 |
Hi,
Updating Ids from After trigger will cause the problem of id references to others table.
Suppose You have following table data
Id Name Sal 1 AA 5000 2 BB 6000 3 DD 12000
Now you deleted 2nd record then after trigger will update the table like
Id Name Sal 1 AA 5000 2 DD 12000 (Previous Id 3)
That may create problem if somewhere Id=3 have any reference.
Instead of this you can create a view having a separate row Number column, which will allways display you sequential numbers even u delete some records from middle of tables.
Thanks Vaseem
|
| Author: Vijaya 05 Jul 2008 | Member Level: Diamond | Rating: Points: 4 |
Hi, When you say refresh means you want to adjust the ID automatically??? Why do you want to do it? What will u get by doing this? Its easy to give any solution, but its very important to understand the requirement and provide right direction. Thanks -- Vj http://dotnetvj.blogspot.com
|
| Author: Gaurav Agrawal 06 Jul 2008 | Member Level: Diamond | Rating: Points: 3 |
Register urself on this site for earning money by using this link
http://www.rupeemail.in/rupeemail/invite.do?in=MTAxNTM0JSMlS0hqblZtUFI0c3BmTmw2azNNVDhyb1dCaA==
GA
|