SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


I need a broken 10 second SQL Script


I need a broken 10 second SQL Script

Author
Message
krypto69
krypto69
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11360 Visits: 2653
Hi,

I am doing some Q/A work where I am executing a ob that I need to fail - after 10 seconds.

I am running this and it does fail - but it fails in one second:

WAITFOR DELAY '00:00:10'

select top (100) * from sysjobs
WAITFOR DELAY '00:00:10'

select blah


Any ideas



Phil Parkin
Phil Parkin
SSC Guru
SSC Guru (217K reputation)SSC Guru (217K reputation)SSC Guru (217K reputation)SSC Guru (217K reputation)SSC Guru (217K reputation)SSC Guru (217K reputation)SSC Guru (217K reputation)SSC Guru (217K reputation)

Group: General Forum Members
Points: 217652 Visits: 24939
krypto69 - Wednesday, January 24, 2018 6:49 AM
Hi,

I am doing some Q/A work where I am executing a ob that I need to fail - after 10 seconds.

I am running this and it does fail - but it fails in one second:

WAITFOR DELAY '00:00:10'

select top (100) * from sysjobs
WAITFOR DELAY '00:00:10'

select blah


Any ideas

Try putting a 'GO' after your WAITFOR DELAY.



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
GilaMonster
GilaMonster
SSC Guru
SSC Guru (910K reputation)SSC Guru (910K reputation)SSC Guru (910K reputation)SSC Guru (910K reputation)SSC Guru (910K reputation)SSC Guru (910K reputation)SSC Guru (910K reputation)SSC Guru (910K reputation)

Group: General Forum Members
Points: 910638 Visits: 48846
WAITFOR DELAY '00:00:10';
SELECT 1/0;


Yours fails instantly because the last query throws a parsing error, and the batch is parsed before any part of it starts executing.


Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


krypto69
krypto69
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11360 Visits: 2653
GilaMonster - Wednesday, January 24, 2018 7:12 AM
WAITFOR DELAY '00:00:10';
SELECT 1/0;


Yours fails instantly because the last query throws a parsing error, and the batch is parsed before any part of it starts executing.

Ahh..thanks Gail




Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search