Solved

Copy values from one DB to another

Posted on 2014-11-10
1
90 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
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

806 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