SQLTeam.com Logo

Return to Selecting data from different databases

Selecting data from different databases

Written by Bill Graziano on 07 September 2000

GianMarco writes "I need to make a view that includes external data in different DB (still sql, on the same server). How can I do it? In acces I can link external table and then create my query but in Sql?"

You can type something like this from any database:

FROM pubs.dbo.authors

Table names (and all database objects) can be qualified with the database name and owner name of the object with the syntax:

. . . FROM DatabaseName.OwnerName.ObjectName . . .

You could also use something like this:

FROM pubs..authors

This comes in handy when your ISP defaults to having you create objects rather than being aliased to the DBO.