Dear knowledgeable ones
A new problem have arisen.
I have now an SQL database file with about 100 tables in it.
I would like to automatically go through all of these tables and check if the column "Owner" exist.
If this field does not exist, then it should be created and hold a value of type Integer.
This value must also be set to "1" for all existing rows in the table, but not as a "default" value.
Whenever I try to work this functionality I always get an error if the column of the table does not exist.
I try doing this from Delphi via Firebird SQL version 1.5, but I find no functionality for checking for column ID without causing an exception.
What I am after could be programmatically described as:
FOR x:=1 TO TotalCountOfTablesInDataBase DO BEGIN
WITH Table x DO BEGIN
IF EXIST(Column("Owner"))=FALSE THEN BEGIN
CREATE Column("Owner", INTEGER);
SELECT ALL ROWS;
SET Column("Owner")=1;
END;
END;
END;
I don't need error exception handling, but can this functionality be made without?
Delphi uses InterBase components and the SQL part installed is Firebird version 1.5
Many thanks in advance.