Is it possible to Union 6 Columns with different tables different database and different server?
Please tell me if this is possible or not?
Is it possible to Union 6 Columns with different tables different database and different server?
Please tell me if this is possible or not?
If you're looking to query across multiple databases on different servers using SQL Server, you should look at linked servers >> http://msdn.microsoft.com/en-us/library/ms188279.aspx
Once you've added all the linked servers you need to access, the tables on those servers can be accessed as if they were "local". Then you just need to worry about performance.
AS previous answer you need linked servers for a start.
When the servers have been added to your server where you are executing the query from you can run the query as follows
SELECT Field1 , field2
FROM LINKED_SERVER1.DatabaseName.dbo.tableName_X
UNION ALL
SELECT Field1 , field2
FROM LINKED_SERVER2.DatabaseName.dbo.tableName_Y
You can add as many tables to the union as you like, just following basic UNION rules. I.e all of the selects in the union must have the same number of fields, and of compatible datatypes