Code.GeekInterview.com
  I am new, Sign me up!
 
Code Samples SQL Server
 

Delete Duplicate Records


Code ResourceAuthor: gupt_12  

Difficulty Level:

Published: 6th Nov 2006   Read: 1719 times  

Filed in: SQL Server
Add Comment


 


Removing Duplicate Records in Sql. Execute the below statements in sequence

 


Sample Code
  1.  
  2. SELECT * FROM table1
  3. SELECT DISTINCT * INTO table2 FROM table1
  4. DELETE table1
  5. INSERT INTO table1 SELECT * FROM table2
  6. SELECT * FROM table1
  7. DROP TABLE table2
  8.  
Copyright GeekInterview.com


Next: Change to Proper case Function


 

Latest Code Samples

 

Popular Code Samples

 

Related Code Samples

 

Post Comment


Members Please Login

Name:  Email: (Optional. Used for Notification)

Title:
 
Comment:
Validation Code: <=>  (Enter this code in text box)





Comments

In oracle we have rowid to uniquely identify every records. Do we have anything of that sort in DB2.

Because this would be a time consuming process if number of constraints/indexes defined on the table are more.

Comment posted by: jamesravid on 2006-11-23T06:04:11

Popular Coders

# Coder NameHits
1. Jim.Anderson1731
2. gupt_121720

Active Coders

# Coder NameCodes
1. gupt_121
2. Jim.Anderson1

Refined Tags

 

Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact  

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape