Home » questions » Transact-SQL?

Transact-SQL?

2006-08-02 23:15:58, Category: Programming & Design
Is it possible to do a SELECT that joins tables from 2 different databases, for example if Northwind database has a table Customer and Pubs database has a table Employee, how do I create a select statement that finds any duplicates .... in MySQL you could do it like this: select Northwind.Customer.Name from Northwind.Customer join Pubs.Employee on Northwind.Customer.Name = Pubs.Employee.Name How does one do it in SQL server? Thanks for reading!

Answers

  1. Hulett H

    On 2006-08-02 23:29:54


    There are possible four dots (five elements) in an fully qualified identifier: . . . . How many you need depends on your scope, but you generally can't skip one in the middle. Oh, and table aliases raise your quality of life. SELECT c.Name FROM Northwind.dbo.Customers c INNER JOIN Pubs.dbo.Employee e ON c.Name = e.Name