Limiting a table to 10 records
I need a guru's help here. What is the best query to have a table that contains only the latest 10 entries? I don't care if the previous entries get lost.
Specifically, I want to keep track of the latest 10 articles viewed on our website... but it seems that simply adding a new record and then querying the last 10 would eventually result in a bloated table that contains data that we simply will never use.
So I'm basically asking what the best way is to add an entry to the table and have the 11th oldest entry deleted.
Does this make sense?
Thanks for any help or direction here...
add and delete on one process
It would be a 2 step process but in the same process.
I will look into this and make sure that this is the correct process but here is what I am thinking.
Begin
Insert * from [......data.....]
Delete from [datatable.tablename] where ID = #### (or what ever format you use for this)
GO
The draw back with this is that is one fails, they BOTH fail so make sure that you have this configured well.
Rick