Re: ISQL Begin Work & Commit Work
Posted in 1997
Hi, Richard.
Let's assume you're doing a LOAD.
I would execute something like:
BEGIN WORK;
LOCK TABLE this_tab IN EXCLUSIVE MODE; {Optional but I prefer this}
LOAD FROM "this_data.unl" INSERT INTO this_tab;
I would not include a COMMIT or ROLLBACK at this stage. If the LOAD
runs without crashing and claims to have loaded the number of rows I
expected I would then run COMMIT WORK as a singleton statement or, if
the LOAD failed, run a ROLLBACK WORK.
In practice I might well have split the load file so that actual script
would be:
{COMMIT WORK;}
BEGIN WORK;
LOCK TABLE this_tab IN EXCLUSIVE MODE; {Optional but I prefer this}
LOAD FROM "xaa" INSERT INTO this_tab;
If all went well I'd uncomment the COMMIT and change xaa to xab.
Likewise if I had a long list of operations I'd start with:
BEGIN WORK;
<command for 1st operation>
{
COMMIT WORK;
BEGIN WORK;
<command for 2nd operation>
...
etc
...
}
and then work my way down commenting out completed operations and
uncommenting the next operation, always starting with the COMMIT for the
previous job.
Regards
Ian
Jevon Richard wrote:
>
> Please could anyone tell me how to use the BEGIN WORK, COMMIT WORK and
> ROLLBACK statements in ISQL.
>
> The main question is How do you find out what the status of an UPDATE,
> INSERT so to determine whether to ROLLBACK or COMMIT WORK ??
>
> Am i missing the point ?
>
> Richard Jevon
> Nottinghamshire County Council
> e-mail zprj1@nottscc.gov.uk