Solved

Copying  data from one table to another

Posted on 2008-06-25
6
693 Views
Last Modified: 2008-06-25
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
0
Comment
Question by:Ennio
6 Comments
 
LVL 60

Expert Comment

by:chapmandew
ID: 21865320
insert into sometable(fieldname1, fieldname2, fieldname3)
select fieldname1, fieldname2, fieldname3)
from someothertable
where somecriteria
0
 
LVL 1

Author Comment

by:Ennio
ID: 21865412
But for example
someothertable is in another server not in the same server as sometable.
0
 
LVL 60

Assisted Solution

by:chapmandew
chapmandew earned 200 total points
ID: 21865445
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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 75

Assisted Solution

by:Aneesh Retnakaran
Aneesh Retnakaran earned 50 total points
ID: 21865454
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
 
LVL 8

Accepted Solution

by:
DenverRick earned 250 total points
ID: 21865702
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
 
LVL 1

Author Comment

by:Ennio
ID: 21865868
Using the export/import function worked great, and it was simple
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
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.

856 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