Results 1 to 2 of 2
  1. #1
    Join Date
    May 2003
    Location
    New York, NY
    Posts
    225

    Question Unanswered: Trapping for a Key Violation Error Code

    I have a query that appends records to a sql table. The sql table "tblQueues" has one field that is the primary key (Serial Number Field) which is a sequential number. so I have a procedure that gathers the records that I need to import into the tblQueues table and puts them in a table called tblAlerts then another query queries the tblQueues table for the last Serial Number and assigns the next x number of serial numbers to the tblAlerts records (i.e. 5 records in the tblAlerts table the next 5 Serial numbers will be assigned to the records in the tblAlerts Table).

    I want to plan for all possiblities so I want to assume in the 2 or 3 microseconds it takes my proc to run one or more other users are adding records into the tblQueues table thus utilizing one or more of the serial numbers that I have already selected. I want my proc to trap for the Key Violation Error Code and then I want the part of my proc that selects the serial numbers from the tblQueues table to run again and then attempt to append (insert - sql speak) the new records. Unfortuntely, I can not change the tblQueues table and I only have Insert Rights to this table.


    So please help me, Thank you in advance!!


    Mark
    Last edited by Mark Gambo; 05-21-03 at 15:23.

  2. #2
    Join Date
    Oct 2002
    Posts
    61

    Similar Problem

    I had a similiar problem and I just used an error handler to trap for the error.


    Cheers

Posting Permissions

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