| Can we blocks execution of batch, store procedure or transaction in SQL for certain time?
Yes we can do that and to do that we use WAITFOR keyword for this. We can do this for sepcified time or time interval. Below is the syntax and one example for that.
Query Example 1:-
(1)Below will run query after 5 seconds
BEGIN
WAITFOR DELAY '00:00:05';
select top 10 * from tbl_name
END;
(2)Below will run on certain time(This will run on 1PM in after noon)
BEGIN
WAITFOR TIME '13:00:00';
select top 10 * from tbladsadded
END;
Please take care of error time elapased and check the session for time out error | | |