Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Insert Data Between Servers

Author  Topic 

ddrake
Starting Member

2 Posts

Posted - 2003-10-01 : 10:00:51
Hi,

I am new to sql server and I am wondering if anyone can tell me how to insert data from an existing table on one server into a new table on a different server, using transact sql.

Darren

Nazim
A custom title

1408 Posts

Posted - 2003-10-01 : 10:35:05
there are couple of ways to do it.
1) you can use sp_addlinkedserver , sp_addlinkedsrvlogin and use the four part naming convention (server.database.user.objectname) to retreive the data of another server.
2) you can also use openquery or openrowset

HTH

-------------------------
What lies behind you and what lies ahead of you are small matters compared to what lies within you.-Ralph Waldo Emerson
Go to Top of Page

ddrake
Starting Member

2 Posts

Posted - 2003-10-01 : 11:05:15
I understand, but could you please submit an example. Thanks.
quote:
Originally posted by ddrake

Hi,

I am new to sql server and I am wondering if anyone can tell me how to insert data from an existing table on one server into a new table on a different server, using transact sql.

Darren



Darren
Go to Top of Page

graz
Chief SQLTeam Crack Dealer

4149 Posts

Posted - 2003-10-01 : 12:12:44
(Note: I moved this out of the Article Discussion forum and into the Developer forum).

-Bill

===============================================
Creating tomorrow's legacy systems today.
One crisis at a time.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-10-01 : 12:21:29
quote:
Originally posted by ddrake

I understand, but could you please submit an example. Thanks.
quote:
Originally posted by ddrake

Hi,

I am new to sql server and I am wondering if anyone can tell me how to insert data from an existing table on one server into a new table on a different server, using transact sql.

Darren




Do you have books online?

Lots of examples there....

Plus what's the name of there server you want to link to?


Darren



Brett

8-)

SELECT @@POST FROM Brain ORDER BY NewId()

That's correct! It's an AlphaNumeric!
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2003-10-01 : 12:54:44
Be careful about what you are doing. If this is included as part of a process on the source server you have to decide whether you want to bind the two servers. i.e. if the remote server is not available do you want the whole process to fail or just the transfer of data.
It is usually better to make the transfer asynchronous so thatt the destination is a bit behind but will automatically catch up if there are network problems.
I prefer to do this by either creating a table on the source server for the data transfer which the destination reads for fairly reliable and secure links or by creating text files from the source which are transferred then read by the destination for unreliable or unsecure links.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -