Answer: Suppose we want to execute one query now one one after some time then we need to use
WAITFOR TIME for this.
Sample Query:
BEGIN
SELECT 'Lakhan Pal'
DECLARE @time char(5)
SET @time=CONVERT(char(5),DateAdd(mi, 1, GetDate()),108)
WAITFOR TIME @time
SELECT ' Garg'
END
In the above Code SELECT 'Lakhan Pal' will be execute first and then after 1 min second select statement SELECT ' Garg' will be executed.
Asked In: Many Interviews |
Alert Moderator