Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Problem querying the Information database
Sun, Mar 14 2010 5:59 AMPermanent Link

Richard

ENT Technologies

This query always returns 0:

Session.Execute('Select * from Information.TableColumns where TableName = ' + Engine.QuotedSQLStr('Table1') +
' and Name = ' + Engine.QuotedSQLStr('Fax'));

I know the field exists, because when I execute:

Database.Execute('ALTER TABLE Table1 ADD Fax VARCHAR(20) COLLATE "ANSI_CI"')

It tells me that the column 'Fax' already exists. What have I done wrong here?

Thanks.
Sun, Mar 14 2010 6:16 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Richard

>Session.Execute('Select * from Information.TableColumns where TableName = ' + Engine.QuotedSQLStr('Table1') +
>' and Name = ' + Engine.QuotedSQLStr('Fax'));

Here you're querying the configuration database and

>Database.Execute('ALTER TABLE Table1 ADD Fax VARCHAR(20) COLLATE "ANSI_CI"')

here you're altering a table in your database.

What you need is

Datbase.Execute('Select * from Information.TableColumns where TableName = ' + Engine.QuotedSQLStr('Table1') +' and Name = ' + Engine.QuotedSQLStr('Fax'));

Roy Lambert [Team Elevate]
Sun, Mar 14 2010 6:46 AMPermanent Link

Richard

ENT Technologies

> Roy Lambert wrote:
>
> What you need is

> Datbase.Execute('Select * from Information.TableColumns where TableName = ' +
> Engine.QuotedSQLStr('Table1') +' and Name = ' + Engine.QuotedSQLStr('Fax'));


Fixed.

Thanks.
Image