September 1, 2005 at 2:52 am
hi,
Need one help here.
I want to create a view in a database in which a table from another database is displayed.
Thanks.
September 1, 2005 at 3:41 am
Something like this?
CREATE VIEW dbo.foo
AS
SELECT ... FROM otherdb.dbo.bar
Do not forget about ownership chaining though if that affects you.
September 15, 2005 at 5:44 pm
The above example will work if the database is on the same instance. If you want to extend this further and wish to query from a table from a database that resides on a separate instance, then look up "linked servers" in BOL.
In that case, you can create a linked server and then the view will select from that remote table either by using a four part naming convention or via a passthrough query (openquery/openrowset).
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply