Error on this code "GO WAITFOR DELAY '00:00:05'"

  • I want to run a "GO" and then pause for 5 seconds. When I run this code I get "A fatal scripting error occurred.

    Incorrect syntax was encountered while parsing GO" Does anyone know why this and how I can run a pause after a GO?

    These two statements run fine when they are separate.

    Thanks!

  • "GO" is not a SQL Statement, so you should just remove it.

    GO is a batch separator for some clients.

  • malik_nagel (11/23/2010)


    I want to run a "GO" and then pause for 5 seconds. When I run this code I get "A fatal scripting error occurred.

    Incorrect syntax was encountered while parsing GO" Does anyone know why this and how I can run a pause after a GO?

    These two statements run fine when they are separate.

    Thanks!

    As Michael mentioned above, it's a batch separator in SQL. Go 50 also loops the previous batch 50 times. THus, it doesn't like WAITFOR.

    Best way is, if looping, start your batch with your waitfor, or just put it after the GO.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply