Hello guys,

i have 5 records in my table.when i delete any record from the table i want to auto update record's id in my table.
ex.say 5 records from ID 1 to 5.when i delete record 3, the following records 4 n 5 id are changed from id 4 n 5 to 3 n 4 as i have deleted 3rd record .

expecting help from u guys.

thanks & regards

possible but besides your id something should be unique otherwise your update statement will never work.

and consider a case currently you are having 5 records and u r deleting record no 3..
so record no 4 & 5 gets updated..

but wot if in future you have more than 1 million records..now wot..?
can u imagine after a deletion of any record in between..
how many update statement will get fired in order to adjust your id..!

one more case wot if your id has references in child table..
then you have to update those references too..


wise option...take your time & Plan this whole thing again..
last question..why do u have such kind of requirement..!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.