I have two sql database at different PC.how can link b/w
database and database tables.

Answers were Sorted based on User's Feedback



I have two sql database at different PC.how can link b/w database and database tables...

Answer / 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

I have two sql database at different PC.how can link b/w database and database tables...

Answer / anil

You can also use curl function for use defferent database

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More MySQL Interview Questions

What is the difference between mysql_fetch_array and mysql_fetch_object?

4 Answers   CTS,


What are the advantages of myisam over innodb?

0 Answers  


How do we delete a row in a table?

0 Answers  


How do I export mysql query results to excel?

0 Answers  


What is dbms in mysql?

0 Answers  






Write a query to display even rows in student table using mysql?

0 Answers  


change column name and make a unique column so we get no dupes.

0 Answers  


How do I install and use mysql?

0 Answers  


How to get the current date in mysql?

0 Answers  


How to save images in MySQL?

2 Answers  


Consider a scenario where you have two to three tables with thousand tuples in each of them. Now, if you have to perform a join operation between them will you choose to perform filtering of rows or transforming of rows first.

0 Answers  


How can we repair a MySQL table?

2 Answers   Infosys,


Categories