Re: testing if a field exist
Posted in 1998
Hi John.
To check if the field exists in the table try the following:
select colname from syscolumns where tabid in
(select tabid from systables where tabname="your_table_name")
and colname = "your_column_name"
To check if the table exists try to run the following:
select tabid from systables where tabname = "your_table_name"
Hope this helps
Regards
Alexander Leites
John Gunnarssin <it@jamtway.se> '''''''' ' ''''''
<3667D9C9.CE64C7E1@jamtway.se>...
> Hi folks !
>
> In SQL i need to know if a specific field exist in a table, and if that
> field
> not exist, then i should create it with alter table.
> I also need to know if the table exist, and if not i should create it.
> Maybe someone could help me with this.
>
> thank.
> --- John Gunnarsson, Imperia
>
> ps.
> please send a copy of your answer to it@jamtway.se
>
>
>