Solved

Copy values from one DB to another

Posted on 2014-11-10
1
95 Views
Last Modified: 2014-11-10
I have the following script to copy records from one database to another, problem is I get an error because the table and fields already exist on the target database, which is OK, I don't need to create them I only need the data to be copied from source DB to target DB

SELECT
   legal_entity_sk as legal_entity_sk,
   company_sk as Employerid,
   first_name as FirstNm,
   last_name as LastNm,
   middle_name as MiddleNm
INTO BDotSiskindImport.dbo.Users
FROM Siskind.dbo.legal_entity
GO
0
Comment
Question by:amucinobluedot
[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
1 Comment
 
LVL 69

Accepted Solution

by:
Qlemo earned 500 total points
ID: 40433203
In that case use an INSERT statement:
insert into BDotSiskindImport.dbo.Users
(Employerid, FirstNm, LastNm, MiddleNm)
select  legal_entity_sk, company_sk, first_name, last_name, middle_name
from  Siskind.dbo.legal_entity

Open in new window

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

762 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