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
 General SQL Server Forums
 New to SQL Server Programming
 Move data from one table to another ongoing

Author  Topic 

frist44
Starting Member

12 Posts

Posted - 2010-06-24 : 18:08:30
I need to move data from one server to another on an ongoing basis. The data isn't organized the same, so I would essentially be doing a query on the source to find the data, and then put it into the target.

How would I go about doing this?

Thanks!

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2010-06-25 : 01:54:10
can you describe your problem a bit detailed? maybe post some sample data, what are you moving (or copying), how many times per day/hour, etc.
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2010-06-25 : 01:56:55
There a number of approaches:
a)DTS \ SSIS
b)Standard job -

Will the target be one table or a number of tables?

Jack Vamvas
--------------------
http://www.ITjobfeed.com
Go to Top of Page

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2010-06-25 : 02:52:56
What you basically do is to create a query like this and schedule it using sql server agent every x minutes. If you need it to run continously you'll basically do the same thing but make sure to add an eternal while loop around your insert statement:
WHILE (1 = 1)
BEGIN
INSERT INTO targettable (Col1, Col2)
SELECT Col1, Col2
FROM sourcetable
WHERE...
END


- Lumbago

My blog (yes, I have a blog now! just not that much content yet)
-> www.thefirstsql.com
Go to Top of Page

frist44
Starting Member

12 Posts

Posted - 2010-06-25 : 10:24:08
I think the DTS probably makes the most sense. However, i'm a little stuck. Hopefully you guys can point me in the right direction. We essentially want a data refresh of data from one server to another every night. The harder part is that the tables are completely different. So I have the source query all straight. A customer ID comes out of the source. However, when I go to the target, the customer ID is translated to an Account # for the particular table I want the data to live, so I need to do a query on another table in the destination to translate Customer ID -> Account #. What do I put in between the source and target to get this?
Go to Top of Page
   

- Advertisement -