Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fake a long running SQL statement

Tags:

sql

sql-server

I want to fake a long running SQL statement so I can experiment with sys.dm_exec_requests

"Fake" isn't the best way to describe it, but does anyone have a good tip on perhaps selecting autogenerated records? Perhaps using a CTE?

like image 385
Alex KeySmith Avatar asked Jan 03 '13 11:01

Alex KeySmith


People also ask

What is SQL false?

It is also used as Boolean data type in SQL Server. You can store only 0, 1 or NULL in a bit data type. When used as Boolean data type, 0 is treated as false and 1 as true.

Can you write a loop in SQL?

In programming, a loop allows you to write a set of code that will run repeatedly within the same program. Many programming languages have several different types of loop to choose from, but in SQL Server there is only one: the WHILE loop.


1 Answers

Here's a long-running SQL statement:

WAITFOR DELAY '0:05';

It will take around five minutes to execute.

like image 77
AakashM Avatar answered Sep 27 '22 19:09

AakashM