How do I execute a large SQL Script with many GO statements from within Delphi? -


we have updater application executes sql scripts of on 30,000 lines of code on sql server database. in script large number of go statements. ado components i'm used using not support go statement. we've used osql command-line when updating server, tricky catch problems (outputs text file have parse errors , results). more ideal if in delphi able find go statements , execute each block @ time.

i understand go statement specific ms tools able execute them. again script on 30,000 lines of code, @ least 500 go statements. use same script in sql management studio , osql updater. osql isn't giving results need - it's sloppy way of executing such script.

is there existing sql server compatible tool delphi recognizes go statements? i'm not talking parser (although i'm sure parsing involved), i'm talking ready-made utility execute sql scripts contain go statements , return results of each script block.

for example, 1 block might create table, , go, , create stored procedure table , go. code complex implementing in code this question quite out of question.

update

i have written small bit of working code this, not take consideration go statement within comment block.

code found here

i'm not asking further in question, thought i'd share this.

loading script tstringlist work. looking word go on line (which avoids embedded text containing go) end of each block or script itself.

you use go line's index - 1 mark end of prior block, , go line index + 1 start of next block. if go index equal stringlist.count - 1, you've reached end of script. can start transaction before processing blocks, , roll transaction if exception raised.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -