Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Column Exists
Mon, Jul 30 2007 5:34 PMPermanent Link

Michael Thompson
Is there a way to find out if a column exists in a table.

I am trying a statement like this

If column does not exist then

alter table etc...

I'm doing it right now with try except but there has to be a cleaner way.
Mon, Jul 30 2007 8:59 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Michael,

<< Is there a way to find out if a column exists in a table. >>

Use a query on the Information schema table TableColumns:

SQLString:='SELECT * FROM Information.TableColumns '+
                  'WHERE TableName=''MyTable'' AND Name=''MyColumn''';

if (MyEDBDatabase.Execute(SQLString)=0) then
  // Execute ALTER TABLE

http://www.elevatesoft.com/edb1sql_tablecolumns_table.htm
http://www.elevatesoft.com/edb1d7_querying_database_objects.htm

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Jul 31 2007 3:10 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim


When is EXISTS likely to make a reappearance?

Roy Lambert
Tue, Jul 31 2007 8:49 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< When is EXISTS likely to make a reappearance? >>

I'm not sure if it is yet, but I'll look into it further here as I move
along with 1.06.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image