|
|
 |
RE: FN-FORUM: ODBC Query two DB's
date posted 4th August 2005 22:07
So long as the logged in user has rights to see both databases;
Select t1.field1, t2.field2
FROM databasename1.dbo.tablename t1,
databasename2.dbo.tablename t2
WHERE
t1.id =3D t2.id
HTH
Cheers
Andy
-----Original Message-----
From: [EMAIL REMOVED] [EMAIL REMOVED] On Behalf Of
[EMAIL REMOVED]
Sent: 04 August 2005 17:22
To: Andy Macnaughton-Jones
Subject: RE: FN-FORUM: ODBC Query two DB's
Hi Andy, both DB's are on the same server what should use to pull the
record sets out?
I wanted to use excel but how would I run a select in excel? I can only
make 1 ODBC connection at a time or have I got this wrong?
Andrew
> You can do;
>
> SELECT t1.field1, t2.field2 FROM DB1.DBO.TABLENAME t1,=20
> DB2.DBO.TABLENAME
> t2 WHERE T1.id =3D3D t2.id
>
> So long as the databases are on the same server.
>
> You *can* do it with differnet servers (best via a stored procedure)
>
>
> -----Original Message-----
> From: [EMAIL REMOVED] [EMAIL REMOVED] On Behalf Of=20
> [EMAIL REMOVED]
> Sent: Wednesday, August 03, 2005 11:11 AM
> To: Andy Macnaughton-Jones
> Subject: FN-FORUM: ODBC Query two DB's
>
>
> Hi All, I am producing a report based on information coming from 2=20
> DB's both of which reside on the same MS SQL server. Having made the=20
> ODBC conncetion I am quite happy pulling in the respective tables from
> one DB want I now want to do is pull in the Tables/fields from the DB=20
> but this is where I loosing the plot.
>
> I am thinking along the lines that I need a VB command or some kind of
> dual ODBC connection. Am I making this more comlicated than it really
> is?
> I only have one common ID to match to and that is ProductId
>
> Andrew
>
>
>
>
>
> --
> Freelancers, contractors earn more with Prosperity4 Call 0870 870 4414
> or visit www.prosperity4.com and benefit from Inland Revenue approved=20
> expenses today.
>
> To advertise here: http://www.freelancers.net/advertising.html
>
>
> --
> Freelancers, contractors earn more with Prosperity4 Call 0870 870 4414
> or visit www.prosperity4.com and benefit from Inland Revenue approved=20
> expenses today.
>
> To advertise here: http://www.freelancers.net/advertising.html
>
>=20
--
Freelancers, contractors earn more with Prosperity4 Call 0870 870 4414
or visit www.prosperity4.com and benefit from Inland Revenue approved
expenses today.
To advertise here: http://www.freelancers.net/advertising.html
|
 |
|