Automated update scripts

  • Hi, I plan to create a program to allow user to execute batch scripts to update the database by double click the program instead of execute every scripts by query analyzer. At first, I try to use the ADODB's Execute method to run the scripts, but I get the error "Incorrect syntax near 'go'" because the method do not support the 'go' command. After do the search online about 4 hours I still cannot find a best solution for my problem. So, I post the message to the forum to see whether anyone can help me to solve it.

    Actually, I find some posible methods to solve this problem, but I don't have confident it is a best solutions or not. First method is to write a function to remove the 'go' command before I execute the script. It is look like very dangerous cause removing the 'go' command may generate other error. Second method is to use the isql utility, but I don't have much of experiance about this method.

    Thank you.

  • This is not correct as shown below.

    From SQL Server Books OnLine regarding GO:

    Your program should behave in the same manner as the utilities. When a GO is found, the prior input should be executed but the GO is not part of the statement and should not be passed to SQL Server. After executing the statement, clear the execution variable, build the next statement until another GO is found or end of file is reached.

    SQL = Scarcely Qualifies as a Language

  • This Topic is resolved. Please refer to http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=23&messageid=231494

    Thank you.

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

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