equivalent of WAITFOR DELAY in TD

Database
Enthusiast

equivalent of WAITFOR DELAY in TD

Greetings,

Is there any command in TD what would equivalent to "WAITFOR DELAY" in SQL server?  

 

Scenario:

In one TD stored proc, I do have a select statement as:

(psedo):  SELECT UniqueID FROM computer where ComputerID = xxxx AND Domain = 'abcd' AND region = 'zzzz'

If the record already exists in the Computer table, a UniqueID would return

If not, then an insert statement will fire up to insert these values to the table and return the newly created UniqueID.

 

It's that simple.  However, yes, however, due to the massive amount of calls of the sproc in a given moment, duplicate records will occur.   

To reduce this error, I would like to put a "WAITFOR DELAY 00:00:01" 1 second in the select statement to make sure TD could have enough time to insert the previous and run the SELECT statement again.  This time will have a valid UniqueID returned. 

 

I have studied some other approaches but this is the optimal way to handle.  

 

Thanks

JPL

4 REPLIES
Junior Contributor

Re: equivalent of WAITFOR DELAY in TD

I don't understand what exactly you're trying to do.

Can you show your current SP(s) and explain how this new UniqueID is created?

Enthusiast

Re: equivalent of WAITFOR DELAY in TD

Thanks for your reply, dnoeth.  My question is simple:  

Is there any command in TD what would equivalent to "WAITFOR DELAY" in SQL server?  Yes/No?  If yes, what would that be? 

 

Thanks

Highlighted
Teradata Employee

Re: equivalent of WAITFOR DELAY in TD

The simple answer: NO, there is no equivalent function.

 

But a 1-second delay seems like a far from optimal solution to the real problem. Perhaps if you explain in more detail what you are trying to do and the problem you are trying to solve, someone can help you come up with a better design.

 

 

Teradata Employee

Re: equivalent of WAITFOR DELAY in TD

Hi JPL,

 

Is there any unique index (primary or secondary) on (ComputerID, Domain, Region) ?

Is your table SET or MULTISET ?

How UniqueID is created, is it an Identity column ?

How much is massive amount of calls of the SP ?

 

As you see, more informations would help to understand your scenario and provide adequate solution.