0

I am trying to transfer data between databases, but cannot get INSERT to work.

USE [db1_Name]

GO

INSERT INTO [dbo].[company$Customer]

[No_]      
GO


USE [db2_Name]
GO

SELECT 

[No_]     
FROM [dbo].[company$Customer]

GO
Nadeem_MK
  • 7,533
  • 7
  • 50
  • 61
P A Hemingstam
  • 93
  • 2
  • 12
  • Possible duplicate with http://stackoverflow.com/questions/7554157/select-into-statement-where-source-is-other-database. – Ola Ekdahl Oct 08 '14 at 08:40
  • 1
    `insert into [db1_name].[dbo].[company$Customer] select [No_] from [db2_Name].[dbo].[company$Customer]` – vhadalgi Oct 08 '14 at 08:42

2 Answers2

2

Change your script to

INSERT INTO DbnameTarget.[dbo].[company$Customer]
SELECT
Colum1,Colum2
FROM DbnameSource.[dbo].[company$Customer]

Replace Dbnames,colums with your own

Binson Eldhose
  • 749
  • 1
  • 6
  • 14
  • thank you! unfortunately, at the end of the day this wasn't the command I was looking for! It was actually UPDATE I needed to use. Anyway, thanks for helping :) – P A Hemingstam Oct 08 '14 at 09:40
0
  Select * into [DestinationDB].dbo.tableName 
  from [SourceDB.dbo].SourceTable 

(or) select * into [Destinationserver].[DestinationDB].dbo.tablename from [Sourceserver].[SourceDB].dbo.tablename

DBname
  • 11
  • 2