Tuesday, March 27, 2012

Creating Views

Hai Guys,
Can i create a view by joining 2 tables that r on two different database.
Good Day.
Thanks.
Shabuyes, it's possible.|||How do i do this.
I have one server with 2 databases.
my DB server is Sqlserver2000.

Please Help.

Thanks .|||This should probably do it, if you have linked the servers ...

create view NameOfTheView as
select someField, someOtherField
from
ServerName1.DBName.dbo.TableName Server1,
ServerName2.DBName.dbo.TableName Server2,
where
Server1.Field1 = Server2.Field1 and
<insert some other suitable conditions here ...>|||Something like:SELECT s.sysadmin, d.owner
FROM msdb.dbo.sysdtspackages AS d
JOIN master.dbo.syslogins AS s
ON (s.name = d.owner)-PatP|||you need to run sp_addlinkedserver for the remote server
then run sp_addlinkedsrvlogin to create login maps
then invoke the four part name in the query

BOOKS ONLINE{sp_addlinkedserver}
BOOKS ONLINE{sp_addlinkedsrvlogin}
BOOKS ONLINE{Distributed Queries}

this can be done easily in the enterprise manager
SECURITY>LINKED SERVERS

this is kind of the way a partitioned view is created check out federated servers in books online|||you need to run sp_addlinkedserver for the remote server
then run sp_addlinkedsrvlogin to create login mapsDid I miss a meeting somewhere? When did a second server join this discussion?

-PatP|||Did I miss a meeting somewhere? When did a second server join this discussion?

-PatP

whoops
my bad

ignore my pre-post-question post that i had just posted

No comments:

Post a Comment