Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

I must confess, I have often wanted to use WAITFOR TIME because that's what I have: a desired point in time that I want the code to wait for.

However, I have always ended up using WAITFOR DELAY even if it means doing extra work; e.g., a DATEDIFF calculation.

My concern is this line from the Help: If the current server time is greater than the time specified, processing is suspended until that time on the following day.

Consider the following pseudo-code:

SET @t = obtain or calculate a desired "wait for" time 
   that is 0.01 seconds in the future;
Perform some operation that might take more than 0.01 seconds to perform;
WAITFOR TIME @t;

Most of the time, WAITFOR will wait for less than 1/10th of a second. Sometimes, however, CURRENT TIME may be > @t, which means the WAITFOR waits for about 24 hours.

Egad! Zounds! That's not what I want!

What I think I want is WAITFOR TIMESTAMP. Until then, I'll stick to WAITFOR DELAY.

asked 25 Mar '10, 09:46

Breck%20Carter's gravatar image

Breck Carter
32.5k5417261050
accept rate: 20%


I would vote also for an enhanced behaviour. WAITFOR TIME is only usefull if you build something like a scheduler.

permanent link

answered 21 Oct '10, 07:49

Thomas%20Duemesnil's gravatar image

Thomas Dueme...
2.7k293965
accept rate: 17%

1

Kind of funny, Breck's question has WAITed FOR a long TIME to get an answer:)

(21 Oct '10, 08:32) Volker Barth
1

I used the Command the first time and the documentation is really strange. Wine also gets better when you let it breath.

(21 Oct '10, 10:04) Thomas Dueme...
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×113

question asked: 25 Mar '10, 09:46

question was seen: 1,469 times

last updated: 29 Oct '10, 13:24