Pausing Execution in T-SQL?

How can I pause T-SQL execution to simulate a delay? I need a test script that mimics a slow external service for validating asynchronous scalability.

hey try waitfor delay ‘00:00:05’ to mimic a slow response in tsql. it worked fine on my tests when i needed a pause. give it a go!

In scenarios where a delay is required for simulating an external service, another option is to use the WAITFOR TIME command. Instead of specifying a fixed delay, this approach allows you to compute a future time using the current system time, effectively pausing the T-SQL execution until that moment arrives. I have found this particularly useful during asynchronous scalability testing to replicate network latency. It is important to note that such techniques are best used solely within testing environments as they intentionally block the process, which might not be optimal in production settings.