General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Tyler,
Check out the stored procedure NextID in Tastrade.
Your method will cause duplicate values if 2 users hit it at the same time. You would need a PoolIDs table with one record (containing the counter) for each type of pool. You need to seek in it to see if the Pool is there, if not add the Pool and start the counter with 1.
In addition to the TasTrade example, Craig Berntson has a nice paper and routine about this on his website.
>I have a table that has pool, hand and number fields. If the user wants to add a new record, I check the table for the pool that the user wants to add a record for. If it isn't in the table, I give that record a number of 1. If it is I want to increment the last number for that pool by one. So there would be multiple records with the value of 1 or any other number for that matter. I can't think of a way to do this. Any help would be appreciated.Thanks,
>
>Tyler
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only