Solved

Copying  data from one table to another

Posted on 2008-06-25
6
695 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

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
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how the fundamental information of how to create a table.

696 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