SQL Server - block execution of a sql command for a certain period of time

By [)ia6l0 iii

SQL Server provides you the WAITFOR DELAY clause that helps you to delay the execution of a command for certain amount of time.

SELECT [Status] FROM BatchJobs WHERE JobId = 5
--Wait for 15 minutes
WAITFOR DELAY '00:15:00'
SELECT [Status] FROM BatchJobs WHERE JobId = 5

The second SELECT statement executes 15 minutes after the first select.

Related FAQs

Use the Sysindexes table to find the number of rows in a table.
You can now do the inline variable assignment in SQL Server 2008.
Varchar can store non-Unicode character data where as nvarchar can store Unicode character data.
You can use the DBCC INDEXDEFRAG command to defrag the indexes on a table. It is a faster approach versus Rebuilding indexes. Also note that, DBCC INDEXDEFRAG commands are replaced with the ALTER INDEX command in versions starting from SQL SERVER 2005
There is no workaround to change the datatype of a Timestamp column. You will have to drop the column and recreate it.
The compound operator in SQL Server 2008 offers the simpler syntax which all developers looked for.
SQL Server - block execution of a sql command for a certain period of time  (1958 Views)