Using xSQL Builder
Custom Scripts
Custom scripts are T-SQL script that you can choose to run
either before synchronization (pre-sync) or after the
synchronization (post-sync). They must exist on the client machine
where the package runs. You can choose to run a single file or the
entire set of files in a folder. When a folder of scripts is
specified, the package runs all the files with .sql extension in
the specified folder in alphabetical order. The following rules
apply to the custom scripts:
- The whole set of pre-sync scripts is executed in one single
transaction. If one of them fails, the entire set is rolled back
and the process stops.
- The entire set of post-sync scripts is executed in one single
transaction. If one of them fails, the entire set is rolled back
and the process stops.
- If a custom script contains multiple batches separated by GO,
batches are executed one at a time within the same transaction. If
a batch fails the entire set of custom scripts is rolled back and
the process stops.
This behavior is defined in the code template which is provided
with xSQL Builder. You can change it to accommodate your particular
scenario.