Designing query in Editor - Linking tables from other database in design mode


  • How does one add tables to a Query editor from different databases? I can see tables in the object explorer window on the left side but cant see the table when I try work in design mode. Please help

    What I actually want is to add tables from diffrent databases to query editor by using Add Table ... window.

    Thanks and Regards

    Dr. Hasan Bhutta

    Wednesday, September 11, 2013 2:17 PM


All replies

  • Use a synonym to create a local object that points to the table in the remote database.  This is a general best-practice for cross-database queries and it enables the query designer.  eg

    create database a
    create database b
    use a
    create table t(id int)
    use b
    create table u(id int)
    create synonym t for a.dbo.t



    Wednesday, September 11, 2013 2:25 PM
  • You  can do it with Drag & Drop from other databases to the design mode of query or view. 

    The most important motivation for the research work that resulted in the relational model was the objective of providing a sharp and clear boundary between the logical and physical aspects of database management. - E. F. Codd
    Saeid Hasani's home page

    • Proposed as answer by Saeid Hasani Wednesday, September 11, 2013 2:32 PM
    Wednesday, September 11, 2013 2:29 PM
  • You can Drag & Drop to the View design window, but the query design window is a modal popup so you can't drag tables onto it from the object explorer (at least in SSMS 2012).



    Wednesday, September 11, 2013 3:24 PM