This is a discussion on delete last added row -how to within the SQL Server forums, part of the Microsoft SQL Server category; --> hi i have a question how can i delete last added row. I have 2 tables . source and ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| hi i have a question how can i delete last added row. I have 2 tables . source and destination . I take a 1 row from source table , do some operation on it and save to destination table . after succesfull written I want to delete added row from source table.. i'm using a coursors. the main problem is : is there any function to check which row was last added. Now I am doing it using select * from destionation where (and necessary conditions). but if destination table will be 100000000 rows for example it takes too much time... Is there another possibility to do it ??? please help Marcin Wolku wolku |
| |||
| One important think both tables don't have primary key Użytkownik "Marcin Wolku" <wolku@epf.pl> napisał w wiadomości news:42805b7b@news.vogel.pl... > hi i have a question how can i delete last added row. I have 2 tables . > source and destination . I take a 1 row from source table , do some > operation on it and save to destination table . after succesfull written I > want to delete added row from source table.. i'm using a coursors. the > main problem is : is there any function to check which row was last added. > Now I am doing it using select * from destionation where (and necessary > conditions). but if destination table will be 100000000 rows for example > it takes too much time... Is there another possibility to do it ??? > please help > > Marcin Wolku > wolku > |
| ||||
| Unless you can identify the last inserted row by some column or columns in the table you cannot delete that row. There is no special feature for determining the insertion order. The most important problem you have is the lack of a primary key. Why don't you fix this? This is a fundamental design flaw as I hope you know. -- David Portas SQL Server MVP -- |