-1

i want to do this one to my child table.

check the primary key.It does not contains Identity Specification.

when inserting data my table should be like this when i delete a record it should be shown below.

how can i do this after deleting the record i want to update the next rows ....,and the result should like below

how can i do this any ideas..., please this is important for me...,

Anjali
  • 1,680
  • 4
  • 26
  • 48
  • possible duplicate of [mysql delete,autoincrement](http://stackoverflow.com/questions/13643938/mysql-delete-autoincrement) Don't do this! Have a look at the answers in the duplicate question. – fancyPants May 30 '13 at 12:52

2 Answers2

0

Create a Trigger, that refreshes your data after the delete query runs:

CREATE TRIGGER [dbo].[TableDeleted]
    ON [dbo].[Table]
    AFTER DELETE
AS
BEGIN

   BEGIN TRAN X
       UPDATE Table SET Column1 WHERE...
   COMMIT TRAN X
END 
bastos.sergio
  • 6,684
  • 4
  • 26
  • 36
  • Please don't support this. Have a look here, why this is not a good idea. http://stackoverflow.com/questions/13643938/mysql-delete-autoincrement – fancyPants May 30 '13 at 12:55
  • His question is valid. The OP doesn't have autoincrement turned on. He has a compound primary key, where he wants to reorder one of the columns. – bastos.sergio May 30 '13 at 13:06
0
UPDATE dbo.table 
    SET splr_Slno=splr_Slno-1 
WHERE 
splr_Slno> @splr_Slno AND splr_Id= @Splr_Id
bvr
  • 4,786
  • 1
  • 20
  • 24
Anjali
  • 1,680
  • 4
  • 26
  • 48