C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !






Delete Duplicate Records in Sql Server 2000


Posted Date: 13 Aug 2008    Resource Type: Code Snippets    Category: SQL
Author: Kundan Kumar SinhaMember Level: Gold    
Rating: Points: 7



Let u s say we have a table Dup_Rec having two columns code and

detalis.
Code - Details
001 - First
002 - Second
001 - First
002 - Second
003 - Three

The following code sample will create an temporary table, copy the duplicate records in temp table and then delete the duplicate records from the original table. Now insert the record from Temp to Origainal table. Drop temp table.


select code,detalis into #Temp_table from Dup_Rec group by code,detalis having count(*) > 1

delete from prcl where (rccode in (select code from Dup_Rec group by code having count(*) > 1) and rate in (select details from Dup_Rec group by details having count(*) > 1) )

insert into Dup_Rec select * from #Temp_table

Drop table #Temp_table





Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Deleting duplicate records  .  Delete Duplicate Records in Sql Server 2000  .  Delete duplicate records  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Syntax of UNION ALL in SQl Server 2000
Previous Resource: Count record from the multiple tables
Return to Discussion Resource Index
Post New Resource
Category: SQL


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use