vijay reddy

vijay reddy

  • NA
  • 13
  • 4.1k

Before insert how to check the records if it exists or not

Jul 19 2016 12:10 AM
hi,
 
I created two tables like
create Table A (pid bigint, pname varchar, psource varchar(10))
create Table #temp (id bigint, name varchar, source varchar(10))
table A having lakhs of rows and table #temp having lakhs of  rows
i want to check the records based on #temp table and insert into Table A.
how to check the records before insert values from #temp table to table A
insert into A
(pid,
pname,
psource
)
select
id,
name,
source
from #temp
Please give me the solution for the above query.
 

Answers (9)