Subject Add a field and assign values
Author Gustavo
Hello

I use Delphi 5, IBX and FireBird 1.5.2.

I have the following problem. Suppose TABLE1 has FIELD1 of type VARCHAR(10) and FIELD2 of type VARCHAR(10). I do the following two SQL statements.

ALTER TABLE TABLE1 ADD FIELD3 VARCHAR(10)

UPDATE TABLE1 SET FIELD3 = 'ppp'

The result is that now TABLE1 has 3 fields (FIELD1, FIELD2 and FIELD3) and in every record, FIELD1 and FIELD3 have the value 'ppp'. I did it with Delphi using TIBSQL components and I did it without Delphi using IB_SQL. The result is the same in both cases.

If I commitretaining the transaction after the ALTER TABLE statement, then the result is right (that is: only FIELD3 has the value 'ppp' in every record).

I want to do both statements inside the same transaction without a commit after the first one, because if something goes wrong during the second statement, I want to rollback the ALTER TABLE too. Is there a way to do this?

Thanks in advance

Gustavo


[Non-text portions of this message have been removed]