 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Alex.K Guest
|
Posted: Tue Apr 17, 2007 9:11 pm Post subject: Select data from two different databases |
|
|
Hello,
D2007 - dbExpress - MSSQL
How can I perform Heterogeneous queries?
In the BDE I use :
SELECT D.*, R.S_NUM, A.DISPLAY_NAME FROM
":DB1:TRACKER" D, ":DB1:AINFO" A
INNER JOIN ":DB2:S_REF" R ON (D.PRIMEKEY=R.PRIMEKEY)
WHERE ( CAST(DATESENT AS DATE) BETWEEN :B1 AND :B2) AND (A.AKEY=D.AKEY)
How to do this with dbExpress?
TIA,
- Craig |
|
| Back to top |
|
 |
Bill Todd Guest
|
Posted: Wed Apr 18, 2007 5:33 am Post subject: Re: Select data from two different databases |
|
|
dbExpress does not support heterogeneous queries the way BDE does.
However, SQL Server allows you to join tables in two different
databases. See BOL for details. The syntax IIRC is DbName.dbo.TableName.
--
Bill Todd (TeamB) |
|
| Back to top |
|
 |
Alex.K Guest
|
Posted: Wed Apr 18, 2007 7:16 pm Post subject: Re: Select data from two different databases |
|
|
Hello Bill,
The two databases reside in the same instance of MSSQL.
I can perform the query in SQL Query Analyzer, however, using the dbExpress
controls, how would I do it.
TIA,
-Craig
"Bill Todd" <no (AT) no (DOT) com> wrote in message
news:46255945$1 (AT) newsgroups (DOT) borland.com...
| Quote: | dbExpress does not support heterogeneous queries the way BDE does.
However, SQL Server allows you to join tables in two different
databases. See BOL for details. The syntax IIRC is DbName.dbo.TableName.
--
Bill Todd (TeamB) |
|
|
| Back to top |
|
 |
Martijn Tonies Guest
|
Posted: Wed Apr 18, 2007 9:02 pm Post subject: Re: Select data from two different databases |
|
|
| Quote: | The two databases reside in the same instance of MSSQL.
I can perform the query in SQL Query Analyzer, however, using the
dbExpress
controls, how would I do it.
|
Same way as you do it in the Query Analyzer.
--
Martijn Tonies
Database Workbench - development tool for Microsoft SQL Server, and more!
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com |
|
| Back to top |
|
 |
Alex.K Guest
|
Posted: Wed Apr 18, 2007 10:21 pm Post subject: Re: Select data from two different databases |
|
|
Hello Martijn,
I am new to dbExpress, what controls do I use?
Do I need two SQLConnections? and one SQLQuery? If so, how do I tell the
query how to connect to the DB's?
Any sample code?
TIA,
-Craig
"Martijn Tonies" <m.tonies (AT) upscene (DOT) removethis.com> wrote in message
news:46264111 (AT) newsgroups (DOT) borland.com...
| Quote: | The two databases reside in the same instance of MSSQL.
I can perform the query in SQL Query Analyzer, however, using the
dbExpress
controls, how would I do it.
Same way as you do it in the Query Analyzer.
--
Martijn Tonies
Database Workbench - development tool for Microsoft SQL Server, and more!
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com
|
|
|
| Back to top |
|
 |
Bill Todd Guest
|
Posted: Thu Apr 19, 2007 2:16 am Post subject: Re: Select data from two different databases |
|
|
Alex.K wrote:
| Quote: | I am new to dbExpress, what controls do I use?
|
TSQLDataSet
| Quote: | Do I need two SQLConnections? and one SQLQuery? If so, how do I tell
the query how to connect to the DB's?
|
No. Connect to either database. The SQL statement is executed by SQL
Server, not your application. SQL Server takes care of the database
connections.
--
Bill Todd (TeamB) |
|
| Back to top |
|
 |
Alex.K Guest
|
Posted: Thu Apr 19, 2007 2:59 am Post subject: Re: Select data from two different databases |
|
|
Thanks Bill!
Ok, now it makes sense.. I have been trying to get this to work with
FastReports v4, however, running the same query select statement that I run
in the SQL Query Analyzer which returns a result, it does not return
anything using the dbx-controls in FastReports. Do you know if there is
anything different that I need to do in FR?
TIA,
- Craig
----- Original Message -----
From: Bill Todd
Newsgroups: borland.public.delphi.database.dbexpress
Sent: Wednesday, April 18, 2007 3:16 PM
Subject: Re: Select data from two different databases
Alex.K wrote:
| Quote: | I am new to dbExpress, what controls do I use?
|
TSQLDataSet
| Quote: | Do I need two SQLConnections? and one SQLQuery? If so, how do I tell
the query how to connect to the DB's?
|
No. Connect to either database. The SQL statement is executed by SQL
Server, not your application. SQL Server takes care of the database
connections.
--
Bill Todd (TeamB) |
|
| Back to top |
|
 |
Bill Todd Guest
|
Posted: Thu Apr 19, 2007 5:41 am Post subject: Re: Select data from two different databases |
|
|
Alex.K wrote:
| Quote: | Do you know if there is anything different that I need to do in FR?
|
I know nothing about Fast Reports.
--
Bill Todd (TeamB) |
|
| Back to top |
|
 |
Alex.K Guest
|
Posted: Thu Apr 19, 2007 6:41 pm Post subject: Re: Select data from two different databases |
|
|
Ok, thanks again Bill!
- Craig
"Bill Todd" <no (AT) no (DOT) com> wrote in message
news:4626ac92 (AT) newsgroups (DOT) borland.com...
| Quote: | Alex.K wrote:
Do you know if there is anything different that I need to do in FR?
I know nothing about Fast Reports.
--
Bill Todd (TeamB) |
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|