Page 1 of 1

Adding/Removing columns from table with Zeos in DELPHI

Posted: 26.07.2007, 12:22
by Blitzwunder
Hi,

I want to add/remove column from tables of my firebird 1.5.3 database with ZEOS (6.1.5).

I tried this 2 ways:

1.
Statement: IZStatement;
...
try
pDbMgr.GetDbRef.pFB.startTransaction;
Statement := pDbMgr.GetDbRef.pFB.DbcConnection.CreateStatement;
Statement.Execute('ALTER TABLE UPU_MVL_01 DROP CH5');
finally
pDbMgr.GetDbRef.pFB.Commit;
end;

2.
dsq : tZQuery;
...
dsq := tZQuery.Create(nil);
dsq.Connection := pDbMgr.GetDbRef.pFB;
dsq.sql.Clear;
dsq.SQL.Add ('ALTER TABLE UPU_MVL_01 DROP CH' + IntToStr(i));
try
dsq.ExecSQL;
finally
pDbMgr.GetDbRef.pFB.Commit;
end;

Both ways failed with
"SQL Error: unsuccessful metadata update ERASE RDB$RELATION_FIELDS failed no permission for control access to table UPU_MVL_01. Error Code: -607. This operation is not defined for system tables. The SQL: 'ALTER TABLE UPU_MVL_01 DROP CH5'"

Any ideas?
Thanks

Joerg

Problem found: improper Connection Object

Posted: 26.07.2007, 13:30
by Blitzwunder
Hi,

I finally found the problem. I have used an improper connection object...

Cheers
Joerg