July 30, 2002 at 2:11 pm
I am trying to create a vb exe that lets our users pick a script that they want to run, that updates one or more stored procedures and permissions.
I read Andy's article on his scriptrunner, and have gotten close to a finished product. My hang up is with the "go". I am using executewithresultsandmessages.
Am i barking up the wrong tree, or do I have to parse the file for the go's and run each segement of code individually.
Thanks for any help
Tom Goltl
July 30, 2002 at 2:24 pm
I thought the "go's" would work, haven't looked lately. Can you post a chunk of the code?
Andy
July 31, 2002 at 7:48 am
I copied your code for the section I am having problems with. Here is the line that won't run the entire script:
oDB.ExecuteWithResultsAndMessages sScript, , sMsg.
I get an error with the "go" in the script when I run with that command.
I changed the command to this: oDB.ExecuteImmediate sScript, SQLDMOExec_ContinueOnError
It will now run but I can't get any of the error messages from this command.
Thanks for looking.
Tom Goltl
July 31, 2002 at 8:56 am
Man, I'll have to stop posting code that has bugs in it! Put in a debug.print to confirm that the CommandTerminator property is "GO".
Andy
July 31, 2002 at 9:26 am
The commandterminator property is set to "go". But it certainly doesn't like the go's in the script.
Just so you don't get down, Your sample code is a big help to us hacks.
Tom
July 31, 2002 at 10:46 am
I'll try to research a little more. Only thought that I have right now is maybe the terminator is case sensitive?
Andy
July 31, 2002 at 1:41 pm
I succesfully changed the commandterminator, but that made know difference. The error message: incorrect syntax near "go".
I'll keep on trying.
Thanks
Tom
August 1, 2002 at 3:21 am
Use db.ExecuteImmediate (strTSQLCMD)
then test err.number, this works just fine.
We are using it to rebuild a database object by object from SQL scripts in source control - these scripts have GO statements in them.
Hope this helps. Al
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply