Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking tables between two SQL Server databases 1

Status
Not open for further replies.

Guggly

Programmer
Jan 18, 2004
110
US
Hi! How can I link a table from one SQL Server database into another? I know that I can get a read-only view doing something like this:

Code:
SELECT     *
FROM         OTHERDATABASE.dbo.TABLE

But, I'm hoping for something that shows up as a table and with write access. Is there any way to do this?

Thanks! -- Mike
 
You can insert or update a table in another database on the server as long as the person has permissons to perform that action on that table in that other database.
Code:
/*Update Example*/
update OtherDatabase.dbo.Table
set Col1 = 'SomethingElse'
where Col1 = 'Something'
Code:
/*Insert Example*/
insert into OtherDatabase.dbo.Table
(Col1, Col3)
select Col2, Col3
From Table
wehre Col5 = 'Value'

Denny

--Anything is possible. All it takes is a little research. (Me)

[noevil]
 
Interesting, so I guess I can't really do a link to have an external table show up in the grid, like is possible with Access, right?

Thanks for your help! -- Mike
 
Correct. The grid to create queries is very limited, and doesn't know how to handel tables in other databases or on other servers. Those queries you have to code by hand.

Denny

--Anything is possible. All it takes is a little research. (Me)

[noevil]
 
Well, guess I'll have to learn to live with that :). Thanks! -- Mike
 
no problem.

Denny

--Anything is possible. All it takes is a little research. (Me)

[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top