Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2008
    Posts
    23

    Unanswered: Linking other SQL database tables (newbie question)

    Hello, I'm very new to working with SQL Server. We have many MS Access front ends to some SQL Server databases here where I work.

    I am wondering if I can use a Linked Server to link a table in a different database on the same server? Not sure what to use for Provider, Data source, etc. to do that if a Linked Sever is what I should use. If not, is there a better way to do this? ...and what is it?

    Also, since I have limited experience with SQL Server in the first place I am not sure how to use the Linked Sever once it is set up. Would I create a view or something to pull in the records from the table I link to?

  2. #2
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    you do not need a linked server. just use the fully qualified table name...

    YouDatabaseName.YourSchemaName.YourTableName

    Your schema is probably dbo.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  3. #3
    Join Date
    Mar 2008
    Posts
    23
    Ok, so I put that in a view and linked the Access front end to the view and it works well. Thanks!! I was trying to make it too difficult I guess.

    One other thing, is there any way to create a constraint on the other database's table? I get an error that says...

    "Cross-database foreign key references are not supported. Foreign key 'HDC.dbo.tbl_users'."

    ...when I put that in the REFERENCES part of the ALTER TABLE statment to add a constraint. Or am I forced to deal with that using code?

  4. #4
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    thems the rules.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  5. #5
    Join Date
    Mar 2008
    Posts
    23
    Well, if it's a rule then I should be able to break it.

Posting Permissions

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