0

I have rwo Databases, let's say DB1 and DB2 which DB2 is a copy of DB1 and exactly the same.I also have an empty third Database named Main.How can i create a view within the Main database from the tables of DB1 and DB2.For example if [person].[person] is a table in DB1 and DB2,something like this:

CREATE VIEW v1 AS
SELECT * FROM [DB1].[person].[person] 
UNION
SELECT * FROM [DB2].[person].[person];

P.S. All 3 databases are on the same server!

soeldiablo
  • 169
  • 6

1 Answers1

1

For creating view, you are not needed to have 3rd database as view is nothing but virtual table which is the combination of 2 or more different tables in same or different database or server.

For better understanding of SQL views, please refer SQL Views.