473,406 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

linking tables from other databases?

In a database, I am creating a new db. From there, I am setting up the
tables, so that I can eventually create a front end (usually access,
but I may attempt to be brave and lose the shell.) Anyway, I want to
use a table, read-only for a lookup. It exists in another database on
our system. Is there a way for me to link it into this database that I
am working on? I would think of it like in access when you go to do a
new table and you choose to link the table from somewhere else. That
is what I want to do. Can anyone possibly step me through this?
I know basics of sql server and like to learn.

Thanks!

Jan 17 '07 #1
3 12708

"misscrf" <mi*****@yahoo.comwrote in message
news:11**********************@a75g2000cwd.googlegr oups.com...
In a database, I am creating a new db. From there, I am setting up the
tables, so that I can eventually create a front end (usually access,
but I may attempt to be brave and lose the shell.) Anyway, I want to
use a table, read-only for a lookup. It exists in another database on
our system. Is there a way for me to link it into this database that I
am working on? I would think of it like in access when you go to do a
new table and you choose to link the table from somewhere else. That
is what I want to do. Can anyone possibly step me through this?
I know basics of sql server and like to learn.

Thanks!
Not sure if this is what you need:

This is what I call a tunnel view because it creates a tunnel to pull the
the data through from one database to another. It is not explicitly
read-only, but it will not lock, nor be affected by locks on the source
table.

USE Database2

CREATE VIEW dbo.Table1

AS

SELECT * FROM Database1.dbo.Table1 WITH (NOLOCK)
The same can be done between servers by linking the servers and adding a
third prefix to the table name.

USE Database2

CREATE VIEW dbo.Table1

AS

SELECT * FROM Server1.Database1.dbo.Table1 WITH (NOLOCK)
Jan 18 '07 #2
misscrf,

You can use a view to reference a table in another database as follows:

create view MyView as
select Column1, Column2 ...
from MyOtherDatabase.dbo.MyTable

--or to inherit the schema (owner) use:

from MyOtherDatabase..MyTable

Grant only read privledges on this view.

- Bill

"misscrf" <mi*****@yahoo.comwrote in message
news:11**********************@a75g2000cwd.googlegr oups.com...
In a database, I am creating a new db. From there, I am setting up the
tables, so that I can eventually create a front end (usually access,
but I may attempt to be brave and lose the shell.) Anyway, I want to
use a table, read-only for a lookup. It exists in another database on
our system. Is there a way for me to link it into this database that I
am working on? I would think of it like in access when you go to do a
new table and you choose to link the table from somewhere else. That
is what I want to do. Can anyone possibly step me through this?
I know basics of sql server and like to learn.

Thanks!

Jan 18 '07 #3
Or, in SQL Server 2005, you can use a SYNONYM to accomplish the same
thing, which IMO is a bit more elegant. Check out the CREATE SYNONYM
docs...

http://msdn2.microsoft.com/en-us/ms177544.aspx

-Dave
AlterEgo wrote:
misscrf,

You can use a view to reference a table in another database as follows:

create view MyView as
select Column1, Column2 ...
from MyOtherDatabase.dbo.MyTable

--or to inherit the schema (owner) use:

from MyOtherDatabase..MyTable

Grant only read privledges on this view.

- Bill

"misscrf" <mi*****@yahoo.comwrote in message
news:11**********************@a75g2000cwd.googlegr oups.com...
In a database, I am creating a new db. From there, I am setting up the
tables, so that I can eventually create a front end (usually access,
but I may attempt to be brave and lose the shell.) Anyway, I want to
use a table, read-only for a lookup. It exists in another database on
our system. Is there a way for me to link it into this database that I
am working on? I would think of it like in access when you go to do a
new table and you choose to link the table from somewhere else. That
is what I want to do. Can anyone possibly step me through this?
I know basics of sql server and like to learn.

Thanks!
Jan 18 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Robert Morgan | last post by:
Hi, is it possible to link databases within mysql? I have a access database that I need to import into mysql this db consists of 4 other dbs linked together sharing a common switchboard. Can I link...
3
by: John South | last post by:
I have an Access 2000 front end that I wish to work with a SQL Server 2000 database by means of Linked tables. Do I have to use an ODBC connection to SQL Server? It seems to be the only option...
1
by: Henrik Thomsen | last post by:
Hi NG I have another problem - here it is: I have got two databases, one with containing all data - tables, and the other contains queries, and forms, reports etc. - I have linked the two. ...
0
by: gasturbtec | last post by:
please help im new at access programming and i just got this project dropped in my lap because the old programmer quit. i've been doing ok so far but now i need to add code to an existing database...
4
by: Konstantinos | last post by:
Asking for advise on the following. Suppose you want to build a database for handling some of your personal collections say for instance, your music collection, and your pictures collection. ...
1
by: Daveyk0 | last post by:
Hello there, I have a front end database that I have recently made very many changes to to allow off-line use. I keep copies of the databases on my hard drive and link to them rather than the...
2
by: TheTamdino | last post by:
One of the things that is common between most genealogy databases is that they will have one screen were you log all the information for a given person and then (maybe) have a link to a source...
10
by: Jennifer Carr | last post by:
I have an Access 2003 application that is split into two .mdb files for the interfaces and data. This app is distributed on a CD to be used on computers that have no internet access. When someone...
1
by: lochmant | last post by:
I have a series of about 10 test databases with about 34 linked table each. I need to create an Access 2003 database front end for each of these. I am currently trying to write a script that will...
7
by: Salad | last post by:
I am converting an application from A97 to A2003. I have 2 tables created by another application as a Foxpro.dbf. The table has no index. The connect string in A97 is FoxPro...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.