Solved

In query designer How do I add table from different database

Posted on 2004-09-24
7
284 Views
Last Modified: 2008-07-03
I am creating new view in enterprise manager.
In query designer When I select add table ,It displays  all tables for the current database,
My question is How do I add table from different database same server.

Is it not possible in query designer ?

Thanks
Narendra

0
Comment
Question by:NarendraNisha
  • 2
7 Comments
 
LVL 17

Accepted Solution

by:
BillAn1 earned 43 total points
ID: 12143845
It's not possible to display them in the tables list, but you can type in the full name of the table in the SQL window (database.owner.object) and so include it in your query. However, since there is no referential integrity checks across databases it will not automatically create the join between it and any of your other tables, you will need to manually specify the join.
0
 
LVL 19

Assisted Solution

by:peh803
peh803 earned 41 total points
ID: 12143848
SELECT * INTO targetDatabase.dbo.NewTableName
  FROM sourceDatabase.dbo.SourceData

peh803
0
 

Assisted Solution

by:EliasSportsBureau
EliasSportsBureau earned 41 total points
ID: 12147973
You can also try creating a view in your current database that points to this table on the other database.  That way you can do a select on your view and will not have to create any reference to another database.

Hope this helps
0
 
LVL 19

Expert Comment

by:peh803
ID: 12400520
point split if fine with me..
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question