Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Error on this code "GO WAITFOR DELAY '00:00:05'" Expand / Collapse
Author
Message
Posted Tuesday, November 23, 2010 3:13 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Saturday, March 26, 2011 10:52 PM
Points: 6, Visits: 32
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!
Post #1025526
Posted Tuesday, November 23, 2010 3:20 PM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: 2 days ago @ 2:50 PM
Points: 3,135, Visits: 11,482
"GO" is not a SQL Statement, so you should just remove it.

GO is a batch separator for some clients.
Post #1025530
Posted Tuesday, November 23, 2010 6:47 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 3:09 PM
Points: 6,251, Visits: 7,411
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 | Forum Netiquette
For index/tuning help, follow these directions. |Tally Tables

Twitter: @AnyWayDBA
Post #1025613
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse