Solved

Copy records from one DB to another according to IP address

Posted on 2002-04-29
3
459 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 100 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
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.

728 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