Skip to Main Content

TRIGGER on DELETE to fix column values

819694Dec 3 2010 — edited Dec 4 2010
I have a database as follows:

In table tmp:
A, B
1, foo
2, bar
3, bas
4, zex
5, gur


If I were to delete 'bas' it would leave a hole in the A values, as such:


A, B
1, foo
2, bar
4, zex
5, gur


When a delete is performed, I need to update the values for A as follows:


A, B
1, foo
2, bar
3, zex
4, gur


I believe a trigger is the best way to manage this. Any suggestions for solution?
Comments
Post Details
Added on Dec 3 2010
4 comments
27 views