Re: Newbie to T-SQL

From: Jacco Schalkwijk (jacco.please.reply_at_to.newsgroups.mvps.org.invalid)
Date: 07/16/04


Date: Fri, 16 Jul 2004 10:31:31 +0100

Yes. You have to qualify your tables with the database name and the owner:

SELECT t1.column1, t2.column2
FROM db1.dbo.table1 t1
INNER JOIN db2.dbo.table2 t2
ON t1.<primary key> = t2.<primary key>

-- 
Jacco Schalkwijk
SQL Server MVP
"Sorin Sandu" <ssandu@bizland.ro.invalid> wrote in message
news:eQxjYXxaEHA.4036@TK2MSFTNGP11.phx.gbl...
> Is it posible to make an SELECT over 2 databases ? How ?
>
>


Relevant Pages

  • Re: create a global procedure
    ... > If you don't qualify by owner you will force more scans of the procedure ... Turn on Profiler and watch for the SP:CacheMiss event, ... > by owner and watch it disappear... ... name (unless they actually reside in another database, ...
    (microsoft.public.sqlserver.programming)
  • RE: Truncated INSERT statements when using sp_generate_inserts by Vyas
    ... SET NOCOUNT ON ... This procedure is also useful to create a database setup, ... ALSO NOTE THAT THIS PROCEDURE IS NOT UPDATED TO WORK WITH NEW DATA TYPES INTRODUCED IN SQL SERVER 2005 / YUKON ... IF @owner IS NULL ...
    (microsoft.public.sqlserver.programming)
  • Re: SQL 2005 Express-Database does not have a valid owner?
    ... That means that the database's owner is MYDOMAIN\MyUserName ... My design machine is running Windows XP Pro. ... database diagram. ... Database diagram support objects cannot be installed because this ...
    (microsoft.public.sqlserver.security)
  • Re: conflicting object names in sql server 2000
    ... The owner of the object will depend on the user ... On the local database server when it does the select * from ... she must specify the owner: ...
    (microsoft.public.sqlserver.server)
  • Re: unknown database owner
    ... cleared for the 'Admin' user. ... the "owner is unknown" (you described ... An old database, ... Rick Brandt, Microsoft Access MVP ...
    (microsoft.public.access.security)