Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
View with an UNION between 2 databases
Message
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
00819848
Message ID:
00819872
Views:
11
This message has been marked as a message which has helped to the initial question of the thread.
If the databases are on the same server, you can just reference the table using the three-part name: database.owner.table

SELECT ... FROM mytable
UNION
SELECT ... FROM otherdatabase.ownername.othertable

OTOH, if the other database is on another server, you'll have to create a Linked Server and use that name of the linked server when referencing the other database:

SELECT ... FROM mytable
UNION
SELECT ... FROM linkedservername.otherdatabase.ownername.othertable

-Mike


>I am trying to make a view in SQL server that takes data from two diferent databases. The two tables are exaclty the same and what i need it is a union between them.
>
>The query designer doesn't allow me to do so, so I'm wondering wether this is possible or not.
>
>any clues
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Previous
Reply
Map
View

Click here to load this message in the networking platform