Insert data from one DB table to another DB table

Posted by Nmdjack under LINQ on 3/18/2014 | Points: 10 | Views : 758 | Status : [Member] | Replies : 1
Dear friends,

I have urgent issue in my application. Can you please help me for the following scenario.

I have two table with same schema, In different server. I Need to insert into table from one database to another database table based on user criteria.

Before insert i want to check record is already exists in the designation table or not.

If the records are exists don't want to insert the records. I need to insert only different records.


Posted by: A2H on: 3/19/2014 [Member] [MVP] Bronze | Points: 25

You can acheive your requirement using Insert Into statement in sql
Check the below link for more details

Sample Code is given below
INSERT INTO [SourceDatabase].[dbo].[SourceTable](
Name, DateColumn
SELECT Name, DateColumn
FROM [TargetDatabase].[dbo].[TargetTable] ;

You need to change the column as per your table design

Please mark my reply as answer if it helps to resolve your problem

Nmdjack, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response