No effect on transactions
The following snippet demonstrates that
go
has no effect on
transactions.
create table tq84_go_trx(
id integer identity,
txt varchar(20)
);
go
insert into tq84_go_trx (txt) values ('Insert 1')
begin transaction
insert into tq84_go_trx (txt) values ('Insert 2')
--
-- A go does not commit the current transaction...
--
go
--
-- ... therefore, the following rollback rolls back the insertion
-- of 'Insert 2' into tq84_go_trx.
--
rollback
--
-- Only 'Insert 1' is selected:
--
select txt from tq84_go_trx order by id;
Executing a batch multiple times
go
can be used with an optional number that specifies how often a batch should be executed:
print 'this is printed 10 times';
go 10