How can I cause a timeout exception in a database?

sql, timeout

Solution

What you are looking for sir is the WAITFOR command, database timeouts on queue whenever you feel like it.

Problem

I need to test some ASP.NET code that handles timeout exceptions from a call to a MS-SQL database. I'm able to reduce my CommandTimeout parameter on the connection, however this might cause errors before reaching my code. Is there a simple way to cause the database to timeout 'on cue'?

Original source