Results 1 to 3 of 3

Thread: Simple question

  1. #1
    Join Date
    Jun 2003
    Location
    NJ
    Posts
    8

    Simple question

    Hi all,
    I'm sure this a dumb question, but...

    I have 2 databases set up in MS SQL Server 7. They were imported from Access. In Access, they were linked, but now they no longer are.

    How do I re-link them, so that I can see tables from BOTH dbs when creating a new view?

    Thanks!

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    You can create a view based on tables from multiple databases. All you need is permission to access tables in both databases.

    If you are logged in as sa, then

    create view myview as
    select t1.column1, t2.column2
    from d1.dbo.table1 as t1, d2.dbo.table2 t2
    where t1.somecolumn = t2.somecolumn

    here d1 and d2 are two databases in the same server.

  3. #3
    Join Date
    Jun 2003
    Location
    Malaysia
    Posts
    19

    Wink

    create view myview as
    select t1.column1, t2.column2
    from d1.dbo.table1 as t1, d2.dbo.table2 t2
    where t1.somecolumn = t2.somecolumn

    here d1 and d2 are two databases in the same server.

    just to add more....

    * somecolumn here means the primary key that links the 2 tables...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •