SQL Sequencial Numbers

Results 1 to 2 of 2

Thread: SQL Sequencial Numbers

  1. #1
    Join Date
    Dec 1969

    Default SQL Sequencial Numbers

    Can anyone help please. <BR><BR>I have a SQL table with a primary field that requires a sequencial number. <BR>How do I read that field to obtain the last number, increment it by &#039;1&#039; then use that new number to populate the field. <BR><BR>At the same time I must take into consideration, other users accessing the same database field. <BR><BR>A stored procedure has been suggested, but I have no idea where to start <BR><BR>Paul

  2. #2
    Join Date
    Dec 1969

    Default RE: SQL Sequencial Numbers

    Make that field an autonumer field.<BR>database will automatically increas number by 1 for new records as they get posted in there & will never duplicate.<BR>Other wise when the user posts a new record you would need to Lock the database so nothing else gets posted<BR>query to get that number<BR>add 1 to number<BR>then post<BR>then unlock database<BR>autonumber fields for primary key is wise choice when available.<BR>unless your database doesnt support this?<BR><BR>Russell

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts