I have data that sometimes will be modify. when modify the new data will be insert and the old data still remain inside the database. The same item have their own unique id. So I want to query the data that last modified. How?
They have 1 unique ID and it fixed, so whenever the item been modified, the old data still remain unchanged then a new data will be insert into database with the same unique ID, let say I have items that modified 5 times, so inside my database I have 6 records for the same item, so how can I select the last modified data.
You can add another field to your table of type DateTime. When a new row is inserted, give this column the value of GetDate() function. Write an update trigger to update this new field. Then you can write a query to select the rows those have had change since a particular time.
yes, I already have the field for modified date, I don't update the current row, I just insert new one without interrupt any other rows because my program must not do that.so now I just want to query last modifed row for that particular item.