Ho to use sleep or wait in store procedure in sql? [Resolved]

Posted by Allemahesh under Sql Server on 7/19/2013 | Points: 10 | Views : 1599 | Status : [Member] [MVP] | Replies : 4
There is any way I can use the sleep or wait time in store procedure in sql? If yes, how to do this. If I implement sleep and wait in my SP, how is my performance will affect?
Please help me.




Responses

Posted by: Pandians on: 7/22/2013 [Member] [MVP] Silver | Points: 50

Up
0
Down

Resolved
@Allemahesh

The issue was 60 Seconds become 1 Minute...

So, Please change it to...

WAITFOR DELAY '000:01:00'
SELECT '1 Minute (Or) 60 Second Delay'
GO

Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions

Allemahesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Learningtorise on: 7/19/2013 [Member] Starter | Points: 25

Up
0
Down
According to me Put Sleep/Delay in Front-End....

Way to do same in SQL:

----Delay for 20 seconds
WAITFOR DELAY '000:00:60'
SELECT '60 Second Delay'
GO

----Delay till 7 AM
WAITFOR TIME '7:00:00'
SELECT 'Good Morning'
GO

http://hashtagakash.wordpress.com/

Allemahesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Allemahesh on: 7/22/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
I am getting the below error

Incorrect time syntax in time string '000:00:60' used with WAITFOR.

----Delay for 20 seconds
WAITFOR DELAY '000:00:60'
SELECT '60 Second Delay'
GO

Allemahesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Phagu007 on: 7/22/2013 [Member] Starter | Points: 25

Up
0
Down
You need to use waitfor sql statement to sleep or wait
BEGIN
WAITFOR DELAY '04:00';
EXECUTE sp_helpdb;
END;
GO

Allemahesh, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response