view from another SQL server?
Tim"Tim Kelley" <tkelley@.company.com> wrote in news:e8Zfl0atGHA.4968
@.TK2MSFTNGP03.phx.gbl:
> Is it possible to create a view on one SQL server and add a table to the
> view from another SQL server?
I cannot remember anything stating that it does not work, but I guess
you'll have to use sp_addlinkedserver first.
--
Ole Kristian Bangås
MCT, MCDBA, MCDST, MCSE:Security, MCSE:Messaging, MCTS, MCITP|||This is a multi-part message in MIME format.
--=_NextPart_000_045C_01C6B57F.02DE1260
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
You need to add the remote server as a linked server, using =sp_addlinkedserver.
Then you can use the four part naming convention.
SELECT l.Column1
, l.Column2
, r.Column1
, r.Column2
FROM LocalTable l
JOIN RemoteServer.DatabaseName.Schema.RemoteTable r
ON l.PKColumn =3D r.FKColumn
WHERE {criteria}
-- Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience. Most experience comes from bad judgment. - Anonymous
"Ole Kristian Bang=E5s" <olekristian.bangas@.masterminds.no> wrote in =message news:Xns9812F31EE656Folekristianbangaas@.207.46.248.16...
> "Tim Kelley" <tkelley@.company.com> wrote in news:e8Zfl0atGHA.4968
> @.TK2MSFTNGP03.phx.gbl:
> >> Is it possible to create a view on one SQL server and add a table to =the >> view from another SQL server?
> > I cannot remember anything stating that it does not work, but I guess > you'll have to use sp_addlinkedserver first.
> > -- > Ole Kristian Bang=E5s
> MCT, MCDBA, MCDST, MCSE:Security, MCSE:Messaging, MCTS, MCITP
--=_NextPart_000_045C_01C6B57F.02DE1260
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&
You need to add the remote server as a =linked server, using sp_addlinkedserver.
Then you can use the four part naming convention.
SELECT
l.Column1
, =l.Column2
, =r.Column1
, =r.Column2
FROM LocalTable l
JOIN RemoteServer.DatabaseName.Schema.RemoteTable r
=ON l.PKColumn =3D r.FKColumn
WHERE {criteria}
-- Arnie Rowland, =Ph.D.Westwood Consulting, Inc
Most good judgment comes from =experience. Most experience comes from bad judgment. - Anonymous
"Ole Kristian Bang=E5s"
--=_NextPart_000_045C_01C6B57F.02DE1260--
No comments:
Post a Comment