If you want to use tables that are in separate databases then you can still use both sets of data without any special requirements or syntax.
[source language=”SQL”]
Select
first_name, middle_name,last_name
From
databasename.dbo.Employees
UNION ALL
Select
name_first as first_name, name_middle as middle_name, name_last as last_name
From
databasename.dbo.Salesman
[/source]
If the table is in a different instance then there is another step you have to do. You will have to link the servers together (example). Then you can use the same syntax. The only difference is that you add the linkedserverName to the location. For example
[source language=”SQL”]
Select
first_name, middle_name,last_name
From
linkedservername.databasename.dbo.Employees
UNION ALL
Select
name_first as first_name, name_middle as middle_name, name_last as last_name
From
linkedservername.databasename.dbo.Salesman
[/source]
Looking for quality web hosting? Look no further than Arvixe Web Hosting!