I have two sql database at different PC.how can link b/w
database and database tables.
Answer Posted / meenakshi
we can link database If both the DBs are on same Server and
the current user have access permission on both database
then you can use the following query..
Select SomeColumns From CurrentDBName..TableName
Select SomeColumns From OtherDBName..TableName
If the databases are on different Server then you have to
use the Linked Server..
EXEC sp_addlinkedserver @server = 'SERVER', @provider
= 'SQLOLEDB.1', @srvproduct = '', @provstr
= 'Privider=SQLOLEDB.1;Data Source=TargetServer;Initial
Catalog=Database'
go
Exec sp_addlinkedsrvlogin @rmtsrvname = 'SERVER', @useself
= true, @locallogin = null, @rmtuser = 'Userid',
@rmtpassword = 'Password'
On your SP you can use..
Select * From OpenQuery(MyRemoteServer, 'Select * From
Sysobjects')
--OR
Select * From MyRemoteServer.DatabaseName.dbo.Sysobjects
| Is This Answer Correct ? | 9 Yes | 4 No |
Post New Answer View All Answers
How many rows can be inserted in mysql at a time?
What are the 'mysql' command line options?
What is sql vs mysql?
How do you say mysql?
Is mysql from oracle?
What is row level locking in access?
What is a scalar function?
What is row level locking?
What is offset limit?
What is the difference between unix timestamps and mysql timestamps?
How do I create a mysql database?
Where is mysql used?
How do I start and stop mysql server?
How to define numeric 9(3) in db2 table without decimal point??
How do I find mysql database?