Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 deleting duplicate records 2.

Author  Topic 

Vack
Aged Yak Warrior

530 Posts

Posted - 2008-09-06 : 11:46:53
Now is just want to delete duplicate records where all fields are hte same

table: orderrebate
fields; ord_type
ord_no,
item_no,
line_seq_no,
cd_tp

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2008-09-06 : 12:05:11
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=110167
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-09-06 : 15:05:46
DELETE f
FROM (
SELECT ROW_NUMBER() OVER (PARITION BY ord_type, ord_no, item_no, lin_seq_no ORDER BY cd_tp) AS RecID
) AS f
WHERE RecID > 1


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

ashishashish
Constraint Violating Yak Guru

408 Posts

Posted - 2008-09-13 : 02:48:04
Hi..
If all the values and fields n same in your database than u just add one more column to your table named ID or Something Like that n turn on the identity for that column so,,,,,this field is diff. now u can easily delete records duplicate
Go to Top of Page
   

- Advertisement -