|
Home > Archive > MS SQL Server New Users > October 2005 > Linking table from other MSSQL DB
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Linking table from other MSSQL DB
|
|
| P. Fourny 2005-10-27, 7:55 am |
| Hi,
i'm currently converting a MS Access application to MSSQL.
In Access, i have a primary HelpDesk database that use some linked tables
from another database.
I've created the two DBs on the SQL server (HelpDesk & Contract).
Now, i need to link tables from the Contract DB to the HelpDesk DB, but i
don't known how to do that in MSSQL.
Can someone tell me if it is possible to link table inside a DB from another
DB ?
And if it is possible, how can i do that ?
Regards and thanks in advance
Patrick
| |
|
| what do you mean by link? Union or Join?
Union
Select * from HelpDesk .dbo.tableName
union all
Select * from Contract.dbo.tableName
Join
Select * from HelpDesk .dbo.tableName h join Contract.dbo.tableName c
on h.id =c.id
------------------------------------------------------------------------------------------
"I sense many useless updates in you... Useless updates lead to
defragmentation... Defragmentation leads to downtime...Downtime leads
to suffering..Defragmentation is the path to the darkside.. DBCC
INDEXDEFRAG and DBCC DBREINDEX are the force...May the force be with
you"
-- http://sqlservercode.blogspot.com/
| |
| Sue Hoegemeier 2005-10-27, 7:55 am |
| You don't need to link them. If they are on the same server
and you have the security in place, you would just access
other databases using a three part name qualifier:
DatabaseName.TableOwner.TableName.
So from database One, you can access a table in database Two
with:
select YourColumns from Two.Owner.YourTable
-Sue
On Mon, 24 Oct 2005 14:47:27 +0200, "P. Fourny"
<patrick.fourny@aclux.lu> wrote:
>Hi,
>
>i'm currently converting a MS Access application to MSSQL.
>In Access, i have a primary HelpDesk database that use some linked tables
>from another database.
>
>I've created the two DBs on the SQL server (HelpDesk & Contract).
>Now, i need to link tables from the Contract DB to the HelpDesk DB, but i
>don't known how to do that in MSSQL.
>
>Can someone tell me if it is possible to link table inside a DB from another
>DB ?
>And if it is possible, how can i do that ?
>
>Regards and thanks in advance
>Patrick
>
|
|
|
|
|