we have a table like:
we insert records into the above Table X at a high rate in a multi-threaded fashion.
now, the id should be picked up from another table RefId.
This RefID table stores the Id to be used next when inserting into X and then we have to increment NextUseId by 1.
I query Table X extensively on nam and stock fields.
the updated_datetime is to be populated using getdate().
Now my question i)is what would be the ideal candidates for indexes on X
2)how should i ensure the NextUseId is
not corrupted via multithreaded references.i.e. several clients wanting to insert into X will read nextuseid and then increment it by 1.If this is simulaneous, then there will be data integrity issues.
we have not yet decided on whether to use Sql2k or 2005. so a genric soln would be appreaciated