Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Sql Server Programming

Please help with linking a table to sql server


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...

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc