Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Copy records from one DB to another according to IP address

Posted on 2002-04-29
3
Medium Priority
?
462 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to shrink a transaction log file down to a reasonable size.

609 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