Click to See Complete Forum and Search --> : MS SQL Server 2000 Eval question


krzysieq
10-04-2006, 08:46 AM
Hi.

I have a question. Does anybody know, how to make Microsoft SQL Server wait during execution of queries? I want to make it hang for a while, so I can test if timeouts in my app are working fine. I'd like something pretty much like this:

SELECT some_stuff FROM some_table;
>>> wait 30 seconds <<<
SELECT some_other_stuff FROM some_other_table;

Anyone familiar with this subject? I'd appreciate any help.

Thanks
krzysieq

matt.chatterley
10-04-2006, 11:09 AM
You can achieve this with: WAITFOR DELAY '00:00:30' (format of the string is hh:mm:ss).

If you want to test for timeouts, without having to change code, you could always do this in a query analyser window:

BEGIN TRANSACTION txn_test
UPDATE some_table WITH (TABLOCKX, HOLDLOCK) SET ColX = ColX

.. and then DO NOT COMMIT OR ROLLBACK the transaction until you have tested your timeout handling - it'll hold the lock in query analyser, stopping other queries accessing the table until you end the transaction.


Cheers,

Matt

krzysieq
10-05-2006, 02:03 AM
Thanks a lot.