January 24, 2018 at 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
January 24, 2018 at 7:06 am
krypto69 - Wednesday, January 24, 2018 6:49 AMHi,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.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
January 24, 2018 at 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.
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
January 24, 2018 at 7:26 am
GilaMonster - Wednesday, January 24, 2018 7:12 AMWAITFOR 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
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply