Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: Multiple DB queries


Message #1 by "Xavier Perseguers" <xavier.perseguers@e...> on Sun, 27 Jan 2002 14:34:14
Xavier,
in your post you weren't too specific about the scenario.
To clarify, if the two databases are within the same database server then you can simply reference the tables within them with fully
qualified names as Tomm suggested.
If however, you are talking about connecting to a database on a different database server (for example if you have two different
instances of sql server [even on the same machine] and want to join two tables - one from each) then you should look into using
linked servers.

hth, Arthur Gaisin

---- Message from "Tomm Matthis" <matthis@b...> at Sun, 27 Jan 2002 11:57:00 -0500 ------
You fully qualify the names. I.e.  database1.dbo.table1.fieldname and
database2.dbo.table2.fieldname... etc.

-- Tomm

> -----Original Message-----
> From: agaisin@c... [mailto:agaisin@c...]
> Sent: Sunday, January 27, 2002 6:50 AM
> To: sql language
> Subject: [sql_language] Re: Multiple DB queries
>
>
> I believe this requires the use of linked servers.
> I also believe this is a vendor specific feature so it's not
> supported by all databases and the syntax will vary.
> So, the answer to your question depends on which Database you're
> using locally and which database you want to connect to remotely
> (are they both databases on the same server or different servers?).
> Below are some links to articles on linked servers (specific to sql
> server 7.0 and 2000):
> http://www.sqlmag.com/Articles/Index.cfm?ArticleID=8992&pg=1
> http://www.swynk.com/friends/knight/10linkedservers.asp
>
> hth,
> Arthur Gaisin
>
> ---- Message from "Xavier Perseguers" <xavier.perseguers@e...>
> at Sun, 27 Jan 2002 14:34:14 ------
> How can I create a query joining tables from 2 different databases ?
>
> Thanks
>
> Xavier Perseguers
> $subst('Email.Unsub').
>
>
>
> $subst('Email.Unsub').





  Return to Index