Click here to Skip to main content
15,914,416 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi ,

with the below code i am getting duplicate values , i don't want duplicates for this i am thinking i need to change it into Merge statement.

can any body help me how to change the below code into merge statement

SQL
insert into [dbo].[cmscpt_new] ([Code],[Description] ,[InputOn]
 , [InputBy]  ,[CptReview],[AddedbyApplication],[Status])
   
     
  select [code],[description],getdate(),'101','n','VAN','Active'
   FROM [dbo].[cpt_load_2013]
   -- where current_update_indicator <>'D'  and Modifier ='00'
    where current_update_indicator <>'D' or current_update_indicator is null or  Modifier ='00' or
  Modifier is null 
   
   
   
   update a
   set a.[description]= b.[description] 
    from [cmscpt_new] a, [cpt_load_2013] b
   where a.[Code]=b.[Code]
Posted
Updated 16-Jan-13 1:13am
v2

1 solution

 
Share this answer
 
Comments
FranklinRemo 16-Jan-13 7:30am    
already i have seen this one but i am not able to implement it

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900