Copying data from one table to another

What is the best way to copy data from one table in a BD to another table in other DB.
the tables are not the same tables, so I will need to specify where the data from the source will go in the  new DB and in what field.

In my SQL Managment I have noth DB connected
LVL 1
EnnioAsked:
Who is Participating?
 
DenverRickCommented:
Use the Export/Import function in SQL 2000 or 2005 they are both similar.  After creating the export and imports and setting mappings of the different fields you can save them to a Data Transformation Package and run them anytime you need to.
0
 
chapmandewCommented:
insert into sometable(fieldname1, fieldname2, fieldname3)
select fieldname1, fieldname2, fieldname3)
from someothertable
where somecriteria
0
 
EnnioAuthor Commented:
But for example
someothertable is in another server not in the same server as sometable.
0
Network Scalability - Handle Complex Environments

Monitor your entire network from a single platform. Free 30 Day Trial Now!

 
chapmandewCommented:
Ahh...you failed to mention that in your question.  :)  You're going to need to setup a linked server.

http://msdn.microsoft.com/en-us/library/aa213778(SQL.80).aspx

http://www.databasejournal.com/features/mssql/article.php/3085211
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
Hello Ennio,

you have to create a linked server first, then you can use the following syntax

insert into sometable(fieldname1, fieldname2, fieldname3)
select fieldname1, fieldname2, fieldname3)
from LinkedServerName.dbName..someothertable
where somecriteria


GOD Bless,
Aneesh R.
0
 
EnnioAuthor Commented:
Using the export/import function worked great, and it was simple
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.