Assigning data distributions to SQL Server 2005 databases

Tags:
SQL Server 2005
SQL Server database
In SQL Server 2005, we have two databases. We want the first one to store tables, and the second one to store views of the tables in the first one. We have achieved this if the tables and views are in the same database, but is there a way to do it with two?

Answer Wiki

Thanks. We'll let you know when a new response is added.

This can be done by using the three part name of the table when referencing it within the view.

<pre>CREATE VIEW YourView AS
SELECT *
FROM OtherDatabase.dbo.YourTable
GO</pre>

You will want to enable cross database chaining on both databases, otherwise you will have to grant all users who are using the view SELECT access to the tables which make up the view.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following