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.
Loading
MOHAMED JACKARIAHPosted Mar 18, 2014, 4:30 AM
Jignesh TrivediPosted Mar 18, 2014, 2:07 AM
Hi,
Using Linked server, it is possible...
to create linked server please refer
http://msdn.microsoft.com/en-us/library/ff772782.aspx
http://msdn.microsoft.com/en-us/library/aa560998.aspx
once you have linked server than you can write following query to insert records.
Insert into table1 (col1,col2,col3)
select col1,col2,col3 from [linkedServerName].DatabaseName.Schema.tableName
where col1 not in (select col1 from table1)
hope this will help you.