|
Posted by Russ Rose on 01/18/07 00:00
"misscrf" <misscrf@yahoo.com> wrote in message
news:1169071836.030055.205600@a75g2000cwd.googlegroups.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)
[Back to original message]
|