Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread Problem with SQL on two databases
Wed, Dec 16 2009 5:23 PMPermanent Link

"Adam H."
Hi Guys,

I'm trying to execute a query that obtains data from two different
databases and joins them together. (One of the databases an 'archive',
and the other a current).

On my form I've got 2 x TDBISamDatabase components pointing to the
relevant directories and named the databasename property to 'CurrentDB'
and 'ArchiveDB' respectively.

I find with my SQL that I can execute an sql if I put a physical path in
the SQL, but not the database name.

For example this SQL will work:

SELECT UserRef
FROM "C:\data\current\mytable"
UNION ALL
SELECT UserRef
FROM "C:\data\archive\mytable"

But this one will not:

SELECT UserRef
FROM CURRENTDB\Mytable
UNION ALL
SELECT UserRef
FROM ARCHIVEDB\Mytable

I'm using DBISam 4.27B3 on Windows Vista in Delphi 2007. The application
uses a stLocal connection.

Is it not possible to use the database name to reference the location of
the data?

Cheers

Adam.
Wed, Dec 16 2009 9:46 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Adam,

<< But this one will not:

SELECT UserRef
FROM CURRENTDB\Mytable
UNION ALL
SELECT UserRef
FROM ARCHIVEDB\Mytable

I'm using DBISam 4.27B3 on Windows Vista in Delphi 2007. The application
uses a stLocal connection.

Is it not possible to use the database name to reference the location of
the data? >>

With local sessions, you must use the path names.  With remote sessions, you
can use the logical database name defined for a database directory on the
database server.

--
Tim Young
Elevate Software
www.elevatesoft.com

Wed, Dec 16 2009 11:39 PMPermanent Link

"Adam H."
Hi Tim,

> With local sessions, you must use the path names.  With remote sessions, you
> can use the logical database name defined for a database directory on the
> database server.

OK, no probs - thanks for the info...

Cheers

Adam.
Thu, Dec 17 2009 9:36 AMPermanent Link

"Robert"

"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote in message
news:002A97EB-1735-47B7-9F18-59B39BA34DE4@news.elevatesoft.com...
> Adam,
>
> << But this one will not:
>
> SELECT UserRef
> FROM CURRENTDB\Mytable
> UNION ALL
> SELECT UserRef
> FROM ARCHIVEDB\Mytable
>
> I'm using DBISam 4.27B3 on Windows Vista in Delphi 2007. The application
> uses a stLocal connection.
>
> Is it not possible to use the database name to reference the location of
> the data? >>
>
> With local sessions, you must use the path names.  With remote sessions,
> you can use the logical database name defined for a database directory on
> the database server.
>

Is the issue with the two databases on the same select, or the two databases
on the same query? Would this work?

select into memory\temp * from db1\table;
select * from db2\table
union all
select * from memory\temp;

Robert

> --
> Tim Young
> Elevate Software
> www.elevatesoft.com
>

Thu, Dec 17 2009 1:24 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Robert,

<< Is the issue with the two databases on the same select, or the two
databases on the same query? >>

Neither.  The issue is that he's trying to use a name defined in the Delphi
VCL DB layer via the TDBISAMDatabase component in the SQL, which is not
permitted in DBISAM.

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Dec 17 2009 4:09 PMPermanent Link

"Robert"

"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote in message
news:76E9E767-39B4-4428-B881-5FDF7E982A76@news.elevatesoft.com...
> Robert,
>
> << Is the issue with the two databases on the same select, or the two
> databases on the same query? >>
>
> Neither.  The issue is that he's trying to use a name defined in the
> Delphi VCL DB layer via the TDBISAMDatabase component in the SQL, which is
> not permitted in DBISAM.

duh. Thanks, Tim.

Robert

Image