Board index » delphi » D5 / SQL 7 - Select Statement Problem

D5 / SQL 7 - Select Statement Problem

Could someone help with this problem please. A 'consultant' has changed some code from BDE to ADO in preparation for SQL 7.

The following statement no longer works from Delphi.

SELECT NAME FROM SYSOBJECTS WHERE TYPE = "U"

or

SELECT * FROM SYSOBJECTS WHERE TYPE = "U"

Using the query analyser, these work, but in the Delphi SQL Explorer the first statement returns a blank column and the second one returns all columns except the first one which of course is name!

TIA
Jamie.

 

Re:D5 / SQL 7 - Select Statement Problem


Jamie,

   The SYSOBJECTS table contains field types not supported by Microsoft's
DBLib.  If you need access to those fields, then you must bypass the BDE and
use ADO.

Good luck,
krf

Quote
Jamie Richards wrote in message <39a10077_1@dnews>...

>Could someone help with this problem please. A 'consultant' has changed

some code from BDE to ADO in preparation for SQL 7.
Quote

>The following statement no longer works from Delphi.

>SELECT NAME FROM SYSOBJECTS WHERE TYPE = "U"

>or

>SELECT * FROM SYSOBJECTS WHERE TYPE = "U"

>Using the query analyser, these work, but in the Delphi SQL Explorer the

first statement returns a blank column and the second one returns all
columns except the first one which of course is name!
Quote

>TIA
>Jamie.

Re:D5 / SQL 7 - Select Statement Problem


Column type has changed to nvarchar. Just cast it to VARCHAR.
But with ADO it should work.
--
----------------------
Regards
Robert Cerny
Remove both qwe when replying
email: robert.qwe.ce...@neosys.xrs.qwe.si

No questions via email, unless explicitly invited.

Quote
Jamie Richards wrote in message <39a10077_1@dnews>...

>Could someone help with this problem please. A 'consultant' has changed

some code from BDE to ADO in preparation for SQL 7.
Quote

>The following statement no longer works from Delphi.

>SELECT NAME FROM SYSOBJECTS WHERE TYPE = "U"

>or

>SELECT * FROM SYSOBJECTS WHERE TYPE = "U"

>Using the query analyser, these work, but in the Delphi SQL Explorer the

first statement returns a blank column and the second one returns all
columns except the first one which of course is name!
Quote

>TIA
>Jamie.

Re:D5 / SQL 7 - Select Statement Problem


Use of the system table should be discouraged as their format is not
guaranteed to remain stable across versions of the database. Whew.

The views in the INFORMATION_SCHEMA owner do provide this information, and
it is prettier, e.g.

SELECT
    TABLE_CATALOG,
    TABLE_SCHEMA,
    TABLE_NAME,
    TABLE_TYPE
FROM
    NORTHWIND.INFORMATION_SCHEMA.TABLES
WHERE
    TABLE_TYPE = 'BASE TABLE'

Quote
"Jamie Richards" <jamie.richa...@indosuez.co.uk> wrote in message

news:39a10077_1@dnews...
Quote

> Could someone help with this problem please. A 'consultant' has changed

some code from BDE to ADO in preparation for SQL 7.
Quote

> The following statement no longer works from Delphi.

> SELECT NAME FROM SYSOBJECTS WHERE TYPE = "U"

> or

> SELECT * FROM SYSOBJECTS WHERE TYPE = "U"

> Using the query analyser, these work, but in the Delphi SQL Explorer the

first statement returns a blank column and the second one returns all
columns except the first one which of course is name!
Quote

> TIA
> Jamie.

Other Threads