How can I link a table in database to my database. Both databases are in sql
server 2000. I want that table to be read only to use for a lookup list.thanks
Al
On May 29, 12:50 pm, Al <A
@discussions.microsoft.com> wrote:
> How can I link a table in database to my database. Both databases are in sql
> server 2000. I want that table to be read only to use for a lookup list.thanks
> Al
Your question isn't very clear, but I'm going to guess you mean that
table X is in database A, and you want to use it for lookups in
database B. As long as they are on the same server and permissions
allow you to do so, you can reference any table in any database on the
server within the same SQL expression:
SELECT AX.*, BY.*
FROM A.dbo.X as AX
INNER JOIN B.dbo.Y as BY on BY.FKEYCOL = AX.PKEYCOL
-----------------------------------------------Reply-----------------------------------------------
Hi
What do you mean by linking table; do you mean join
if the databases are on the same sql server machine then the query should be
select t1.cl,t2.c2 from table1 t1 inner join [seconddb].[dbo].[lookuptable]
t2 on t1.id=t2.id
if the database is on some other machine, create a linked server either
using EM or sp_addlinkedserver
select t1.cl,t2.c2 from table1 t1 inner join
[servername].[seconddb].[dbo].[lookuptable] t2 on t1.id=t2.id
Regards
Vt
Knowledge is power;Share it
http://oneplace4sql.blogspot.com
"Al" <A
@discussions.microsoft.com> wrote in message
news:24D83DA3-AF51-4911-9805-2548501C0A26@microsoft.com...
> How can I link a table in database to my database. Both databases are in
> sql
> server 2000. I want that table to be read only to use for a lookup
> list.thanks
> Al