Board index » delphi » select from different aliases and paths

select from different aliases and paths

1. It seems to me a few days ago I saw the message where FROM-clause
involved alias name in query. Unfortunately I can't find that one.
Is it possible to build such query or is it my morbid imagination?

2. When I use ODBC-alias I can build query: select * from
FullPath2Database\TableName.dbf  even if  this ODBC-alias configured to
another FullPath - it works.
Can I give relative path instead of full one?

 

Re:select from different aliases and paths


Quote
On Wed, 17 Nov 1999 11:28:24 +0300, "vavan" <va...@taif-telcom.ru> wrote:
>1. It seems to me a few days ago I saw the message where FROM-clause
>involved alias name in query. Unfortunately I can't find that one.
>Is it possible to build such query or is it my morbid imagination?

To include an alias name in a local SQL statement: enclose the alias name
in colons, prefix the table name with that alias reference, and then
enclose the whole reference in quotation marks.

  SELECT *
  FROM ":DBDEMOS:Customer.db"

Note that the DatabaseName property of the TQuery should be blank.

Local SQL (what the BDE uses for dBASE, Paradox, and FoxPro tables) is
documented in the online help file LOCALSQL.HLP, found in the main BDE
directory. This help file is a language reference of the local SQL
implementation (subset) of SQL-92. The copy of this file that came with BDE
4.x (and earlier versions) was outdated and has since been rewritten.
Updated copies will have the topic "Unsupported language" in the index (and
lack of this topic indicates a pre-update copy). I can e-mail you a copy of
the updated file if you need and desire it.

Your particular question is answered in this help file.

Quote
>2. When I use ODBC-alias I can build query: select * from
>FullPath2Database\TableName.dbf  even if  this ODBC-alias configured to
>another FullPath - it works.
>Can I give relative path instead of full one?

When using dBASE and Paradox tables, by using a path in the SQL statement
like that you are bypassing any ODBC driver and using the native BDE
driver. Thus you can specify any path you wish.

ODBC drivers are a bit more limiting. The database is specified in the DSN
entry for the ODBC driver, accessed through the Windows ODBC Manager. It
could be changed programmatically using ODBC API, though.

==========================================================================
Steve Koterski                  "Computers are useless. They can only give
Technical Publications          you answers."
Borland                                       -- Pablo Picasso (1881-1973)
http://www.borland.com/techpubs/delphi

Other Threads