Q
Problem solve Get help with specific problems with your technologies, process and projects.

Creating a view to retrieve data from more than one database

I am using SQL Server 2000. Is it possible to create a "view" where I can retreive data from more than one database from the same server group. For example, I would like to view from database A all records pertaining to clients x,y and z. Then from database B, retrieve additional information about clients x,y and z that is only available in database B. Note: the "view" that I would like to create is located in database A.

Yes, SQL Server uses a three part naming systems for locating database objects (on a single server, four-part naming for multi-server). From database A you can use the database.owner.table syntax to reference tables in another database. Example:

 CREATE VIEW XYZclients AS SELECT ClientDetails FROM ClientTable cta INNER JOIN B.dbo.ClientTable ctb cta.clientid = ctb.clientid

 

For More Information

Dig Deeper on Microsoft SQL Server Installation

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchBusinessAnalytics

SearchDataCenter

SearchDataManagement

SearchAWS

SearchOracle

SearchContentManagement

SearchWindowsServer

Close