?
Solved

Copy records from one DB to another according to IP address

Posted on 2002-04-29
3
Medium Priority
?
463 Views
Last Modified: 2009-07-29
HI,
How can I copy a whole table and some certain records from one DB to another.
The two DB are identical, but run under a diffrent Ip address.
I execute the SQL commands in MFC application, and connects the DB by ODBC connection.

I know the option of using "sp_addlinkedserver" , but I need to make the connection by IP adderess or by ODBC somehow.

meaning:
I dont want to let one server to know the registration name of the other server,however I want them to know each other by thier Ip Address.

I am using SQL Server 2000.

THanks in advance !!!
0
Comment
Question by:kukiya
  • 2
3 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 6977480
sp_addlinkedserver also accepts IP addresses instead of Server Names.

Alternatives to sp_addlinkedserver would be the usage of OPENROWSET, which is however basically the same thing.

CHeers
0
 

Author Comment

by:kukiya
ID: 6977486
Thanks for the quick answer,
can you pls write me some code example ???!!!
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 400 total points
ID: 6977517
USE master
GO
EXEC sp_addlinkedserver
    '111.222.000.111',
    N'SQL Server'
GO
select * from [111.222.000.111].yourdb..remotetable

or:
SELECT a.*
FROM OPENROWSET('SQLOLEDB','111.222.000.111';'sa';'MyPass',
   'SELECT * FROM pubs.dbo.authors ORDER BY au_lname, au_fname') AS a
GO


Cheers

0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question