Run the rest of SQL Script When Error

Hello,

For example my SQL file contains :

INSERT INTO ************ => run OK
CREATE TABLE ****** => run KO
ALTER TABLE ******* => run OK
When I execute this SQL script file with octopus deploy, it is possible to execute all the script ?
“ALTER TABLE” can be execute even if CREATE TABLE ****** => run KO ?
I tested this by SQL - Execute Scripts Ordered not working

Thanks

Hi @yassine.kerkeni,

Thanks for getting in touch!

If you’re running into problems where the script is failing because the table already exists then you may need to amend your SQL script to perform a check first and only run the CREATE TABLE line if the table doesn’t already exist.

Something like the function detailed here may work.

Regards,
Paul

Hello @paul.calvert,

Thanks for your response
yes I know, that is good practice, but if i have unpredictable problem I don’t like the script stopped I want the rest of script line continue running.
Is it possible ?

Thanks

Unfortunately, there isn’t a way to configure that within Octopus itself. You can enable guided failure but it wouldn’t really complete the script for you.
Octopus isn’t able to evaluate what the script is or where it was in the script when an error occurs, all it can do is report that a failure was encountered.

The error handling would need to be built into the script itself.

Regards,
Paul

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.