Solved

Copy records from one DB to another according to IP address

Posted on 2002-04-29
3
454 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 142

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 142

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now