Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

delay in milliseconds?

3,359 views
Skip to first unread message

Shashank Date

unread,
Mar 3, 2003, 9:37:49 PM3/3/03
to
In SQL 2000, is there a way to create delay which allows sub-second DELAY
times in T-SQL stored Proc ?

BOL mentions this: WAITFOR { DELAY 'time' | TIME 'time' }

But, using this stmt I can only control hours:minutes:secs where as I want
to be able to go into milliseconds.
Any ideas ?

TIA,
-- Shashank

Dan Guzman

unread,
Mar 3, 2003, 9:46:21 PM3/3/03
to
You can specify milliseconds. The following will wait for 100 ms:

WAITFOR DELAY '00:00:00.100'

Note that SQL Server datetime values are only accurate to about 3
milliseconds.

--
Hope this helps.

Dan Guzman
SQL Server MVP

-----------------------
SQL FAQ links (courtesy Neil Pike):

http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
http://www.sqlserverfaq.com
http://www.mssqlserver.com/faq
-----------------------

"Shashank Date" <sd...@everestkc.net> wrote in message
news:d68d85c03fa777d4...@news.teranews.com...

BP Margolin

unread,
Mar 3, 2003, 9:50:28 PM3/3/03
to
Shashank,

Aw, c'mon didn't you even experiment :-)

select current_timestamp
go
WAITFOR DELAY '00:00:00:997'
go
select current_timestamp
go

Heck, I didn't know this before either ;-)

BPM

"Shashank Date" <sd...@everestkc.net> wrote in message news:d68d85c03fa777d4...@news.teranews.com...

Shashank Date

unread,
Mar 3, 2003, 10:11:12 PM3/3/03
to

"BP Margolin" <bpm...@attglobal.net> wrote in message

> Aw, c'mon didn't you even experiment :-)

Never thought about it <sheepish grin>

> WAITFOR DELAY '00:00:00:997'

Well, like Dan says values are only accurate to about 3 millisecs.
I noticed that you can use both '00:00:00:997' colon and '00:00:00.997'
dot before the millisecs.

So is this one of those "undocumented features" ?
To be used with caution then !

Thanks
-- Shashank


Shashank Date

unread,
Mar 3, 2003, 10:13:03 PM3/3/03
to
Thanks Dan !

"Dan Guzman" <dang...@nospam-earthlink.net>

BP Margolin

unread,
Mar 3, 2003, 10:21:26 PM3/3/03
to
Shashank,

> So is this one of those "undocumented features" ?
> To be used with caution then !

Not sure about that. It's certainly not documented by example, but the documentation does say:

'time'
Is the amount of time to wait. time can be specified in one of the acceptable formats for datetime data

which makes me think that it is documented.

I doubt that we'll be able to pin Microsoft down on this, tho' :-)

BPM

"Shashank Date" <sd...@everestkc.net> wrote in message news:33d76d4738129aab...@news.teranews.com...

0 new messages