Sunday, March 25, 2012

Accessing data in a different database?

Hi,
I'm using SQL Server 2000 and I would like to make a view in one database
that returns data from a second database on the same server/instance of SQL
Server. Is this possible? If so, how?
Thanks in advance,
LinnCREATE VIEW dbo.MyView
AS
SELECT <columns>
FROM DatabaseName.dbo.TableName;
GO
"Linn Kubler" <lkubler@.chartwellwisc2.com> wrote in message
news:OcjY0nvbGHA.4900@.TK2MSFTNGP02.phx.gbl...
> Hi,
> I'm using SQL Server 2000 and I would like to make a view in one database
> that returns data from a second database on the same server/instance of
> SQL Server. Is this possible? If so, how?
> Thanks in advance,
> Linn
>|||Assuming that you have appropriate permissions set up, simply use
three-part naming:
SELECT columnList
FROM OtherDatabase.DatabaseOwner.TableName
HTH,
Stu|||Ah yes, that worked great. Thanks Stu and Aaron for the help.
Linn
"Linn Kubler" <lkubler@.chartwellwisc2.com> wrote in message
news:OcjY0nvbGHA.4900@.TK2MSFTNGP02.phx.gbl...
> Hi,
> I'm using SQL Server 2000 and I would like to make a view in one database
> that returns data from a second database on the same server/instance of
> SQL Server. Is this possible? If so, how?
> Thanks in advance,
> Linn
>

No comments:

Post a Comment