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

How to load data from a text file into a table?

7 Answers   Sasaa,


How to find second highest salary from a table?

0 Answers  


What is the latest version of php and mysql?

0 Answers  


How you will show all data from a table.

0 Answers  


What is mysql default database?

0 Answers  






How to Set a root password if there is on root password.

0 Answers  


How to find the unique values if the value in the column is repeated?

0 Answers  


Is mysql owned by oracle?

0 Answers  


Fname Lname City Pin ramesh kumar salem 365241 Query to generate a code having the firstletter of Fname,Lname & 3letter of city Last 3letter of pin,all in capital letters

3 Answers  


What are features of mysql?

0 Answers  


What is DML in MySQL?

1 Answers  


How to use in conditions?

0 Answers  


Categories