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
Did you come across a situation where you had to query for a character range?
for e.g. finding all values in a column whose first character is among a-j. You can use the like operator with the character range in a square brace.
Use the Sysindexes table to find the number of rows in a table.
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
Use Binary or VarBinary fields to store fixed or variable length. These were available in 2005 and 2008 versions only.
There is no workaround to change the datatype of a Timestamp column. You will have to drop the column and recreate it.
Varchar can store non-Unicode character data where as nvarchar can store Unicode character data.
SQL Server - block execution of a sql command for a certain period of time (617 Views)