Subject Re: some meta help would be appreciated
Author Alexander V.Nevsky
--- In ib-support@yahoogroups.com, "william_surowiec"
<william_surowiec@y...> wrote:
> /* create the create generator statement for tables
> where a column is part of the primary key for the table,
> and is the only field in the primary key for the table,
> and the column is an integer
> and the column is not a foreign key
> */

Bill, seems you are inventing something like

Select RC.RDB$RELATION_NAME
From RDB$RELATION_CONSTRAINTS RC, RDB$INDEX_SEGMENTS IDS,
RDB$RELATION_FIELDS RF, RDB$FIELDS FLD
Where RC.RDB$CONSTRAINT_TYPE='PRIMARY KEY'
And IDS.RDB$INDEX_NAME=RC.RDB$INDEX_NAME
And RF.RDB$RELATION_NAME=RC.RDB$RELATION_NAME
And RF.RDB$FIELD_NAME=IDS.RDB$FIELD_NAME
And FLD.RDB$FIELD_NAME=RF.RDB$FIELD_SOURCE
And FLD.RDB$FIELD_TYPE=8
And Singular (Select INC.RDB$FIELD_NAME
From RDB$INDEX_SEGMENTS INC
Where INC.RDB$INDEX_NAME=RC.RDB$INDEX_NAME)
And Not Exists (Select 1 From
RDB$RELATION_CONSTRAINTS RCF,
RDB$INDEX_SEGMENTS IDF,
Where RCF.RDB$RELATION_NAME=RC.RDB$RELATION_NAME
And RCF.RDB$CONSTRAINT_TYPE='FOREIGN KEY'
And IDF.RDB$INDEX_NAME=RCF.RDB$INDEX_NAME
And IDF.RDB$FIELD_NAME=IDS.RDB$FIELD_NAME)

Sorry, I don't like SQL92 syntax, you can rewrite this as you habit.

Best regards, Alexander.