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
Write command to import an mysql file?
What does mysql flush hosts do?
What is dump in mysql?
What are date and time data types?
what is constraints? Also explain the different types of constraints?
what is the default port for mysql server? : Mysql dba
How to run a sql statement?
What is a storage engine?
Can we store videos in mysql database?
Suppose you have to collect the first name, middle name and the last name of students from the below table. But, you observe that there few missing values either in the first name, middle name and the last name columns. How will you return the first non-null values?
Is mysql an oracle product?
How to use sum function in where clause in mysql?
How do you create a new database in mysql?
What is row locking in mysql?
What is mysql and mysqli?