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.
| Author |
Topic |
|
paritosh
Starting Member
42 Posts |
Posted - 2011-09-01 : 03:37:16
|
| in oracle rowid represent the unique row id how to find row_id in sql server or how to delete duplicate row in sql server |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-09-01 : 04:17:13
|
there isn't one in SQL Server.if you are using SQL 2005 / 2008, you can use row_number() to return a running number.To delete duplicate rows in SQL Server :DELETE DFROM ( SELECT *, ROW_NO = ROW_NUMBER() OVER ( PARTITION BY col1 ORDER BY col2 ) FROM YOURTABLE ) DWHERE D.ROW_NO <> 1 KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-09-01 : 04:38:09
|
regardless of any version you can use belowDELETE DFROM YOURTABLE DLEFT JOIN (SELECT col1,MIN(col2) AS MinCol FROM YOURTABLE GROUP BY col1)D1ON D1.col1 = D.col1AND D1.MinCol = D.col2WHERE D1.col1 IS NULL ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|