Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is mysql default database?

1067


How to delete an existing column in a table?

1001


Is mysqli faster than mysql?

981


What is the purpose of mysql database?

967


How do I stop a mysql command?

1045


How is myisam table stored?

1000


How to store values to array from mysql database in php?

990


Can mysql scale horizontally?

1029


How do I edit a database in mysql workbench?

947


What is dump in mysql?

943


Write a query to retrieve a hundred books starting from 20th.

1560


What do we use to remove duplicate records while fetching a data in mysql ?

1014


What is mysql_connect?

997


How to write optimized query in mysql?

1031


How do I view a mysql database?

942