Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-09-20 : 08:26:30
|
Patrick writes "I have a table (Sql 2K Win2k) where answers to questions are stored (30 columns). When the person submits this information, I want to give them a unique 9 digit confirmation number that will refer back to this record.The application is a Web based (VisualFoxPro) multi threaded .dllThe best solution I have so far is to do an execute in a 1000 count try :1. loop with a randon seed 2. ececute execute("insert into dbo.sql)ivr2(confirmnbr) values(?m.p_nConfirmnbr)")3. Trap for an error (the insert failed)4. Incriment the seed by 1However the "error" return is not consistant... I get an "error" when the insert does, in fact work.Thus I wind up with (over 100,000) unused records every dayQuestion: Why it the update happening but there is an error message... or...Is there a better way???Thanks Patrick" |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2004-09-20 : 09:05:48
|
i'm not sure what you mean by "loop with a random seed" -- you are looping a random number of times, inserting numbers over and over into your database until an insert fails? Why would the insert fail (PK constraint violation?)I'm probably not understanding your pseudocode -- can you be a little more specific about what you are trying?- Jeff |
|
|
|
|
|