Subject Re: [ib-support] Re: Check if field exists before adding
Author Milan Babuskov
Paul Vinkenoog wrote:
> Hello Adam,
>
>
>>How do I then add the field to the table if it doesn't exist, i need
>>to do this in one script.
>
>
> Hmmmmm... I've never done that. I always check the result of the test
> SQL in program code, and based upon that I do or don't call the DDL
> script that adds the field.
>
> AFAIK, there is no such thing as conditional DDL.
>
> Maybe somebody else has an idea here.

No, you're correct. This was discussed on this mailing list about 10
days ago, so Adam may search the archives.

You have to combine sql and your application or you can use:

"alter table ... add ..." in your sql script. The statement will simply
fail if field already exists, or add it if it does not. AFAIK, isql will
not exit with error if errors of this type occur, so it should be safe
to execute script like this.

--
Milan Babuskov
http://fbexport.sourceforge.net